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
ravikzm
Employee
Employee

Having two different measures in same dataset - one for Total and another for group by total

I have created two different mesaures to have overall count and TypeCount by grouping.

Mesaure

TotalCount = DISTINCTCOUNT(Query1[Product])
TotalTypeCount = 
TotalIncidentCountByGroupForMonitor = CALCULATE ( COUNT ( Query1[Product] ), ALLEXCEPT ( Query1, Query1[Type] ))
 

Raw Data : 

ProductType
AX
BY
CZ
DX
EX

 

Expected Output in Table/Matrix :

TypeTypeCountOverall Total% of Total
X3560
Y1520
Z1520

 

But getting Output in Table/Matrix when adding the Type :

TypeTypeCountOverall Total% of Total
X33100
Y11100
Z11100

 

Can you please help me to acheive my desired output

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @ravikzm ,

 

Here are the steps you can follow:

 

Single group statistics::

1. Create calculated table.

Table =
var _count1=COUNT('Row Data'[Type])
var _1=COUNTX(ALL('Row Data'),'Row Data'[Type])
var _2=
SUMMARIZE('Row Data','Row Data'[Type],
"Type Count",COUNT('Row Data'[Type]),
"Overall",COUNTX(ALL('Row Data'),'Row Data'[Type]))
return _2

2. Create calculated column.

percen = DIVIDE('Table'[Type Count],'Table'[Overall])

3. Result.

v-yangliu-msft_0-1605490108769.jpeg

Multiple statistical groups:

1. Create calculated table.

Table 2 =
var _count1=COUNT('Row Data'[Type])
var _1=COUNTX(ALL('Row Data'),'Row Data'[Type])
var _2=
SUMMARIZE('Row Data','Row Data'[Week],'Row Data'[Type],
"Type Count",COUNT('Row Data'[Type]),
"Overall",COUNTX(ALL('Row Data'),'Row Data'[Type]))
return _2

2. Create calculated column.

Percen =
DIVIDE('Table 2'[Type Count],'Table 2'[Overall])

3. Result.

v-yangliu-msft_1-1605490108770.jpeg

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@ravikzm ,

I am getting the expected results

Measure = count('Table (3)'[Type])
Measure 2 = CALCULATE(count('Table (3)'[Type]), ALL('Table (3)'[Type]))
Percen = DIVIDE([Measure],[Measure 2])

 

Screenshot 2020-11-12 12.35.42.png

ravikzm_1-1605167748362.png

Can you please help me to get the correct count when grouping by more than 1 column

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.