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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Issue with sum on row and total values

I am using an if statement to check values and it works on row level but on total it uses the total line which give wrong totals

 

xxx % = if([QTY PY]=0,blank(), (([Average price CY]*[Qty CY]) / ([Average price PY]*[Qty CY]))-1)
 
Correct on row level but wrong on totals - how can I use a row total ? In Qlikview its easy to change this but how to in Power BI?
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

In Power BI, the total is not simply the sum of all row values, it will also calculate by the formula.

You may consider to create a new measure by using ISINSCOP() and SUMX() function.

https://docs.microsoft.com/en-us/dax/isinscope-function-dax 

https://docs.microsoft.com/en-us/dax/sumx-function-dax 

measure = IF(ISINSCOPE([axis column]),[xxx %],SUMX(ALLSELECTED('table'),[xxx %]))

It will return xxx % on row level and return the sum of xxx % at total field.

 

Best Regards,

Jay

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

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

In Power BI, the total is not simply the sum of all row values, it will also calculate by the formula.

You may consider to create a new measure by using ISINSCOP() and SUMX() function.

https://docs.microsoft.com/en-us/dax/isinscope-function-dax 

https://docs.microsoft.com/en-us/dax/sumx-function-dax 

measure = IF(ISINSCOPE([axis column]),[xxx %],SUMX(ALLSELECTED('table'),[xxx %]))

It will return xxx % on row level and return the sum of xxx % at total field.

 

Best Regards,

Jay

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

HI @Anonymous ,

 

This is a very common issue when creating measures. Chek the following article on how to resolve this:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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