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
Sagejah9
Helper III
Helper III

Sub totals and grand total are incorrect

Hi 
I created a dax measure to sum total sales but it has a few if conditions to go through before doing the calulation. First I am checking for the currency then check if a line item is in a list of specified items. if both conditions are true then it will do currency conversion in USD and multiply the some by -1 to make it positive. the numbers in the column are negative hence I want to multiply by -1 to make it positive. 
When I put the function in the matrics table it does the conversion and sums the total however its not summing the results as positive. 
How can I fix this. 
var x = values(table[numbers])
Measure  if(selected currency = "CAN", if x in {1,2,3,4,5,6,7}, calculate(sumx(table2, (table2[sales_amount]/related(currency_table[fx_rate])*-1)),calculate(sumx(table2, (table2[sales_amount]/related(currency_table[fx_rate])))


3 REPLIES 3
Greg_Deckler
Super User
Super User

@Sagejah9 First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks @Greg_Deckler , I still dont see where I would use the Hasonefilter. 

@Sagejah9 Generally using ISINSCOPE and HASONEVALUE is better than HASONEFILTER for these sorts of things.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.