cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors