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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
AbbasG
Memorable Member
Memorable Member

NEED HELP WITH SIMPLE DAX

Hello All,

 

I have created a simple measure to calculate margin value (Total sales - total cost). However, for a few lines, it gives weird results.

 

An example is below in blue that my Dax measure produces with the expected outcome in green.

 

AbbasG_0-1673597341025.png

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @AbbasG ,

Does your data contain data with the same column and different values:

vyangliumsft_0-1673857847193.png

When placed on a Visual, the same [Model] is aggregated together.

vyangliumsft_1-1673857847195.png

If you use the Max() function in your Measure, the maximum value of each [Model] will be taken, not the total aggregate value.

vyangliumsft_2-1673857847198.png

You can use the Sum() function to get the aggregate value:

Sum_Measure =
SUM('Table'[Value1]) - SUM('Table'[Value2])

vyangliumsft_3-1673857847201.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @AbbasG ,

Does your data contain data with the same column and different values:

vyangliumsft_0-1673857847193.png

When placed on a Visual, the same [Model] is aggregated together.

vyangliumsft_1-1673857847195.png

If you use the Max() function in your Measure, the maximum value of each [Model] will be taken, not the total aggregate value.

vyangliumsft_2-1673857847198.png

You can use the Sum() function to get the aggregate value:

Sum_Measure =
SUM('Table'[Value1]) - SUM('Table'[Value2])

vyangliumsft_3-1673857847201.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

vaishnaviudan
Resolver I
Resolver I

Hi,

I have added new column with simple DAX you have mentioned above and it is giving correct result. Plz refer screenshot given below. If still you are facing same issue please check if you have applied any filter to grid or not.

vaishnaviudan_0-1673598990873.png

Thanks.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.