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
Anonymous
Not applicable

Total of measure is incorrect

Hello, I am trying to get a "total of cost variance". At row level I get the correct cost variation but the total does not add up. I refered to couple of other post with similar issue but my case is different since my measure has a combination of average and substraction. I have pasted the data table here. Also, in 2nd table, the highlightes area is where the issue is. I am using following to DAX calculations. FIrst one to get just average variance per truck and 2nd to create master meaure column to use in my view.

 

Extra TL Cost = Calculate(AVERAGE('PTA'[FreightCost]),FILTER(ALL('PTA'[Executed Mode]),PTA[Executed Mode]="TL"))-Calculate(AVERAGE(PTA[FreightCost]),FILTER(ALL(PTA[Executed Mode]),PTA[Executed Mode]="IM"))
 
Total TL Variance = if(HASONEFILTER(PTA[Lane]),Calculate(DISTINCTCOUNT(PTA[LOADNUM]),filter(ALL(PTA[Executed Mode]),'PTA'[Executed Mode]="TL"))*[Extra TL Cost],sumx(PTA,[Extra TL Cost]))
 

Capture.PNG Capture1.PNG

 
1 ACCEPTED SOLUTION
rajulshah
Memorable Member
Memorable Member

Hello @Anonymous,

You can try using the following measure to plot in the matrix:

Total Measure = SUMX(SUMMARIZE(PTA,PTA[Lane]),[Total TL Variance])

Hope this helps. 

View solution in original post

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use ISINSCOPE() function to set the value of total row.

Could you please share your sample data and excepted result to me if you don't have any confidential information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

 If possible please share a sample pbix file after removing sensitive information.

 

You are using distinctcount in one formula and distinct count at GT level might not sum of the line level. so can show diff.

 

Thanks


Read and like My Recent Blog -

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
rajulshah
Memorable Member
Memorable Member

Hello @Anonymous,

You can try using the following measure to plot in the matrix:

Total Measure = SUMX(SUMMARIZE(PTA,PTA[Lane]),[Total TL Variance])

Hope this helps. 

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! Prices go up Feb. 11th.

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.