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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count Distinct in Grouping Table

Hi,
I make a summarized pivot table and I need to count distinct sessions by track:

Distinct_Sessions =
Countx(
Filter (
SUMMARIZE('FactEvents', 'FactEvents'[Date],FactEvents[SESSION_ID],'FactEvents'[Page],
"Display",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="widget display" ),
"Click",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="manual_widget_click") ,
"Guest",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="widget_guest_login" ),
"Save",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="guest_save_profile" )
),
[Display]<>"" &&[Click]<>""&&[Guest]="" && [Save]=""
),
?????

So I need to count distinct sessions where :Display<>"" &&Click<>""&&Guest="" && Save="" 
And so for every variation.....

The problem that distinctcount is not accept grouping tables..

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

Countx(
Filter (
SUMMARIZE('FactEvents', 'FactEvents'[Date],FactEvents[SESSION_ID],'FactEvents'[Page],
"Display",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="widget display" ),
"Click",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="manual_widget_click") ,
"Guest",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="widget_guest_login" ),
"Save",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="guest_save_profile" )
),
not(isblank([Display])) && not(isblank([Click])) && not(isblank([Guest])) && isblank([Save])
),[SESSION_ID]
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try like

Countx(
Filter (
SUMMARIZE('FactEvents', 'FactEvents'[Date],FactEvents[SESSION_ID],'FactEvents'[Page],
"Display",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="widget display" ),
"Click",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="manual_widget_click") ,
"Guest",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="widget_guest_login" ),
"Save",CALCULATE(FIRSTNONBLANK('FactEvents'[Event Action],1),'FactEvents'[Event Action]="guest_save_profile" )
),
not(isblank([Display])) && not(isblank([Click])) && not(isblank([Guest])) && isblank([Save])
),[SESSION_ID]
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.