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
Anonymous
Not applicable

how to get sum based on group by columns in DAX measure

hi all,

    I'm using powerbi report server march 2018 desktop version with SSAS tabular model datasource.

i have a query to get sum of distinct values by country column. I have taken DAX to create measure as CALCULATE(SUM(table1[total number of contracts]),table1[Year]=2018,ALL(table1[Country]))))

but this is not giving me the proper result

i have table1 as :pic.PNG

 

 

and many rows like this for each country...

 

so, as my requirement is 

if i take country, SetUp/Set Down, Function in slicer and click Japan in country and AX in function & 2018 in year slicers then i should get only 60, but i'm getting 240 (its considering all questions also) .....how can i get sum of total number of contracts  as 60 using DAX?? 

pls help

thanx in advance..

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may refer to the measure below.

Measure =
SUMX (
    VALUES ( Table1[SetUp/Set Down] ),
    CALCULATE ( MAX ( Table1[total number of contracts] ) )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may refer to the measure below.

Measure =
SUMX (
    VALUES ( Table1[SetUp/Set Down] ),
    CALCULATE ( MAX ( Table1[total number of contracts] ) )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.