Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi everyone,
I need your help.
Initial situation:
Different versions of a document can exist with different total amounts. I would now like to receive the highest version of each document and read out the total amount.
I would then like to display these total amounts summed up per month in a bar chart.
My try:
Latest_Version =
VAR MaxVersionPerDocument =
SUMMARIZE(
'Sales Line Archive',
'Sales Line Archive'[Document No_],
"MaxVersion",
CALCULATE(
MAX('Sales Line Archive'[Version No_])
)
)
RETURN
SUMX(
MaxVersionPerDocument,
CALCULATE(
SUM(Sales Line Archive'[Amount]),
'Sales Line Archive'[Document No_] = EARLIER([Document No_]),
'Sales Line Archive'[Version No_] = EARLIER([MaxVersion])
)
)
Problem:
I believe that the DAX Formula is not quite correct.
In the table it shows me the amount twice, but in the total it only shows one amount.
The assumption is that there are duplicate values in the bar chart.
Does someone have an idea how to adjust the DAX Formula?
Solved! Go to Solution.
@bedata1 Well, I would think something like:
Latest_Version Total =
VAR __GT = SUMX( SUMMARIZE( 'Sales Line Archive', [Document No_], "__Value", [Latest_Version] ), [__Value] )
VAR __Result = IF( HASONEVALUE( 'Sales Line Archive'[Document No_] ), [Latest_Version], __GT )
RETURN
__Result
@bedata1 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
@Greg_Deckler thank you for the links and information.
Would it be possible for you to adjust the DAX formula with your instructions?
@bedata1 Well, I would think something like:
Latest_Version Total =
VAR __GT = SUMX( SUMMARIZE( 'Sales Line Archive', [Document No_], "__Value", [Latest_Version] ), [__Value] )
VAR __Result = IF( HASONEVALUE( 'Sales Line Archive'[Document No_] ), [Latest_Version], __GT )
RETURN
__Result
@Greg_Deckler Thank you Greg, that works.
The only problem I still have is that I have two different dates and so it shows the total on both dates.
How can I add the MAX Date to the DAX formula so that I only get one line?
Hi @Greg_Deckler ,thanks for the quick reply, I'll add further.
Hi @bedata1 ,
I've assumed some data that you can modify based on the DAX expression I provided.
Measure =
VAR _a = CALCULATE( MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Type]))
VAR _b = MAXX(SUMMARIZE('Table',[Type],"Amount",MAX('Table'[Amount])),[Amount])
RETURN IF( SELECTEDVALUE('Table'[Date]) <> _a,BLANK(),_b)
User | Count |
---|---|
57 | |
46 | |
19 | |
16 | |
15 |
User | Count |
---|---|
116 | |
41 | |
40 | |
28 | |
22 |