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

Summerizing a table using if condition

I am making a summarized table with this code:

usershifts = SUMMARIZE(filter(fact_userShifts,fact_userShifts[Discriminator]<>"Parking")
,fact_userShifts[Discriminator],fact_userShifts[UserId],fact_userShifts[KeyColumn],fact_userShifts[IsGuest],fact_userShifts[YrWk],
"countshifts",distinctcount(fact_userShifts[shiftid] ))
What I actually want is to filter out the blank shiftids in the count. Something like this 
usershifts = SUMMARIZE(filter(fact_userShifts,fact_userShifts[Discriminator]<>"Parking")
,fact_userShifts[Discriminator],fact_userShifts[UserId],fact_userShifts[KeyColumn],fact_userShifts[IsGuest],fact_userShifts[YrWk],
"countshifts",distinctcount( if ( isblank(fact_userShifts[shiftid]=False(),fact_userShifts[shiftid] )))
But this is not in the right format and I can't find how to correct it. 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , try like

 

usershifts = SUMMARIZE(filter(fact_userShifts,fact_userShifts[Discriminator]<>"Parking")
,fact_userShifts[Discriminator],fact_userShifts[UserId],fact_userShifts[KeyColumn],fact_userShifts[IsGuest],fact_userShifts[YrWk],
"countshifts",Countrows( Summarize(filter (fact_userShifts, not(isblank(fact_userShifts[shiftid]))),fact_userShifts[shiftid] )))

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

 

usershifts = SUMMARIZE(filter(fact_userShifts,fact_userShifts[Discriminator]<>"Parking")
,fact_userShifts[Discriminator],fact_userShifts[UserId],fact_userShifts[KeyColumn],fact_userShifts[IsGuest],fact_userShifts[YrWk],
"countshifts",Countrows( Summarize(filter (fact_userShifts, not(isblank(fact_userShifts[shiftid]))),fact_userShifts[shiftid] )))

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.