title: Call a stored procedure from Power BI with a DAX parameter
body: <p>I'm currently working with Power BI Desktop and SQL Server 2014 on a POC (proof of concept) asked by my superior (<em>long story short, he said that we were able to do what i'm asking without knowing if it was possible or not...</em>).  </p>
  
  <p>I'm able to see the result of a stored procedure into Power BI when I create a new data source from <strong>SQL Server</strong> with an <strong>SQL instruction</strong> (typed in the advanced options)  </p>
  
  <p>Query : <code>Sql.Database("SERVER\INSTANCE", "DatabaseName", [Query="EXECUTE [dbo].[StoredProcedureName]"])</code><br>
  <em>Source : <a href="https://stackoverflow.com/questions/37589448/how-to-use-sql-server-stored-procedures-in-microsoft-powerbi">How to use SQL Server stored procedures in Microsoft PowerBI?</a></em></p>
  
  <p>I'm also able to display my Windows login using the <code>USERNAME()</code> <strong>DAX</strong> formula. </p>
  
  <p>We use a lot of stored procedures that take the windows login as a parameter and I know that <code>USERNAME()</code> will not return the same value when the Power BI report will be published online, so I'll need to create a table which will allow me to make the correspondence between the Windows login of the user an his/her Power BI account (an email address).</p>
  
  <p>My question is simple : I want to know if I can call a stored procedure with Power BI, using the result of <code>USERNAME()</code> as a parameter of this stored procedure.  </p>
  
  <p>Any help is appreciated, i'm quite stuck at the moment as I didn't use Power BI before...</p>