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
Pbiuserr
Post Prodigy
Post Prodigy

How to handle that in most efficient way - counting blanks / no blanks

Hello,
My next task is to recreate a report based on new schema and data sources. I can see in measures of legacy report, that basically what developer did is : 

Create one measure like

NotBlank = VAR num=CALCULATE(COUNTROWS('Table'),'Table'[Column]<>blank()) RETURN IF(num<>blank(),num,0)
Blank  = VAR num=CALCULATE(COUNTROWS('Table'),'Table'[Column]=blank()) RETURN IF(num<>blank(),num,0)

Similary to count just DISTINCTCOUNTNOBLANK

Is there any better approach? Like establish that in PQ with either 0 and 1 or get the datasource with CASE or how? The drawback of SQL would be that they often count calculated columns, so I guess its not available in SQL/PQ unless I create it there.

These NotBlank and Blank are referenced in several other measures so I can't get them as variables, not convienient I guess

Thank you for your input and suggestions
1 REPLY 1
lbendlin
Super User
Super User

Read about COALESCE and the measure=0+x hack.

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.