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
kkwang
Frequent Visitor

Power BI Group display both total and subcategory

Hi, I have a dashboard like this, what I want is that for the #Turnovers by city column, it will return the city total

 

E.g. for city Beauport, the #Turnovers by City should all have 37 in each row. 

 

what I have now is: 

kkwang_0-1710949367082.png

 

 

 

what I want is :

 

kkwang_0-1710949861267.png

 

 

 

The measure I used is: 

 

#Turnovers by City =
var one_year_filter = FILTER('Table', DATEDIFF('Table'[start.date],TODAY(),MONTH) >=0 && DATEDIFF('Table'[start.date],TODAY(),MONTH) <= 12)                                                                                                    
var two_year_filter = FILTER('Table', DATEDIFF('Table'[start.date],TODAY(),MONTH) >=0 && DATEDIFF('Table'[start.date],TODAY(),MONTH) <= 24)  

return
IF(ISBLANK(SWITCH(SELECTEDVALUE('Passing Month'[Value]),

"Last 12 Months",CALCULATE(COUNT('Table'[number]), ALL(DIMENTION[City]),one_year_filter),        
"Last 24 Months",CALCULATE(COUNT('Table'[number]), ALL(DIMENTION[City]),two_year_filter),


CALCULATE(COUNT('COUNT('Table'[number]), ALLEXCEPT(DIMENSION,DIMENSION[City]))
)),blank(), SWITCH(SELECTEDVALUE('Passing Month'[Value]),


"Last 12 Months",CALCULATE(COUNT('Table[number]), ALL(DIM_RE_HIERARCHY[City]), one_year_filter),        
"Last 24 Months",CALCULATE(COUNT('Table[number]), ALL(DIM_RE_HIERARCHY[City]), two_year_filter),    

CALCULATE(COUNT('Table'[Number]), ALLEXCEPT(DIMENSION,DIMENSION[City]))
)
)
 
 
--------------------------
 
 
can someone kindly take a look help me fix it? thanks so much in advance!!!
4 REPLIES 4
Gabry
Responsive Resident
Responsive Resident

try sumx of your #Turnovers by City  measure over dim(city) table

kkwang
Frequent Visitor

Hi Gabry,

 

I tried to revised the measure to 

 

"Last 12 Months",CALCULATE(SUMX(Table, 'Table'[number]), ALL(DIMENTION[City]),one_year_filter),        
"Last 24 Months",CALCULATE(SUMX(Table,, 'Table'[number]), ALL(DIMENTION[City]),two_year_filter),
 
kkwang_0-1710950357414.png

 

but it doesn't work..

 

 
Gabry
Responsive Resident
Responsive Resident

nope I meant a new measure = sumx(your prev measure, dimtable).

Couldn't you upload the pbix with sample data?

kkwang
Frequent Visitor

Hi Gabry, I tried to use the sumx to create a new measure.. but it's still not wokring..

 

I am sorry, but the data is confidential, I could not post it online due to the policy.

 

but still thanks for your help!! 

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.