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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
joris
Frequent Visitor

DAX Total SUM of Max version incorrect

I've been struggling to get the total sum working using the following measure: 

CALCULATE( SUM(table1[value]) ,table1[version]=MAX(table1[version] ) )

This works fine on a row level, but the totals only return the max version of the total set. I've also tried to change the DAX to 
SUMX(values(Table1[No]), CALCULATE(SUM(table1[value]),table1[version]=MAX(table1[version]))) but I got the same result for the total: 390 instead of 110+190+300+390 = 990

I have to keep the version numbers in the dataset so filtering the max version in Power Query is not an option. Anyone have any ideas? 

Table1  
novalueversion
11001
11102
22001
21902
33001
33002
44001
44502
43903
   
Result  
Novalue 
1110 
2190 
3300 
4390 
Total390 



 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1642427625647.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1642427625647.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

great...that worked 🙂

Samarth_18
Community Champion
Community Champion

Hi @joris ,

 

Try these two measures:-

 

Measure_2 =
VAR max_version =
    CALCULATE ( MAX ( table1[version] ), ALL ( table1[version] ) )
RETURN
    CALCULATE (
        SUM ( table1[value] ),
        FILTER ( table1, table1[version] = max_version )
    )

 

Measure_3 =
SUMX (
    SUMMARIZE ( table1, table1[no], "total", table1[Measure_2] ),
    [total]
)

 

 

Output:-

 

Samarth_18_0-1642423593050.png

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

joris
Frequent Visitor

That didn't work unfortunately. I still get the wrong total: 

joris_0-1642422508789.png

 

amitchandak
Super User
Super User

@joris , Try a measure like

 

var _vrsion = calculate(MAX(table1[version]),Filter(allselected(Table) ,table1[No] = max(Table[No] )))
return
CALCULATE( SUM(table1[value]) ,Filter(allselected(Table), table1[version]=_vrsion && table1[No] = max(Table[No] )))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.