Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ells69
Helper I
Helper I

How to populate the DAX in a measure from a data column

I have a formulas table

ID MeasureName DAXFormula

1       Total Sales            SUM('Sales'[Amount])
2       Total Cost             SUM('Cost'[Amount])
3        Profit                   [Total Sales] - [Total Cost]

What I want is my data set to have the measures already there and then the values come from the formula.
SO when I load \refresh the data if the values in the DAX formula have changed then the measures change.

Kind of like the old dynamic SQL

DECLARE @SQL nvarchar(1000)
declare @Pid varchar(50)
set @pid = '680'
SET @SQL = 'SELECT ProductID,Name,ProductNumber FROM SalesLT.Product where ProductID = '+ @Pid
 
EXEC (@SQL)
2 REPLIES 2
ells69
Helper I
Helper I

ok
Cant upload the link as the address contains sensitive info 

tried to add screen shots but that did not work either

It is self explanatory in the post, Can you populate the DAX of a measure from a table in Power BI?

 

foodd
Super User
Super User

Hello @ells69, and thank you for sharing your question with the Community.  Remember to adhere to the decorum of the Community Forum when asking a question.

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot). You can upload the PBIX file to a cloud storage service such as OneDrive, Google Drive, Dropbox, or to a Github repository, and then share a file’s URL.

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

 

If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.  Proud to be a Super User!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.