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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sean_cochran
Resolver I
Resolver I

Conditional Distinct Count of Values

In a working Deneb visual that displays survey data, I have a relatively flat dataset structured this way:

sean_cochran_2-1726078186567.png

 

When aggregating this data, I want a count of distinct values for "person" - ONLY for rows where "complete" = 0. Also, I do not want to filter the data to achieve this, because I need the filtered rows later for other purposes. My first strategy was to calculate a new column called "distinctPerson" that listed the person column value if "complete" == 1 and showed null otherwise, but the "distinct" count sees 'null' as a distinct value rather than ignoring it. Here is a link to the example in the vega editor. As you can see from the chart, "null" values - which are cases where there is no value in the person column because "complete" = 0 - are counted as distinct values:

sean_cochran_4-1726079375629.png

 

How can I remove these null values from the count (not the chart, the actual aggregation in the background) without filtering the dataset to "datum.Completed == 1" since this would remove necessary information for later? I have tried the following concepts without success:

 

  1. Perform transforms within a lookup (this doesn't seem to work - maybe I'm missing something?)
  2. Define and transform an additional data object that references my initial named dataset and join onto original (I haven't figured out a way to get this working)

If I'm missing something major, please let me know - or if one of the two failed attempts I listed is likely to work, and I'm just using the wrong syntax, let me know and I can provide more info.

 

Thanks in advance!

 

@giammariam 

 

UPDATE:  pbix containning the visual and dataset here.

 

1 ACCEPTED SOLUTION
sean_cochran
Resolver I
Resolver I

I found a simple solution. I used a "missing" op in my aggregation step to detect when null values were present in the data, and then subtracted 1 from the value of a "distinct" aggregation in a later calculate step whenever a null value was present in the series. Sample chart and dataset available at this link in the Vega editor.

Chart below:

sean_cochran_0-1726265049166.png

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Can you share the sample dataset?

Link to pbix file with sample dataset and chart here.

sean_cochran
Resolver I
Resolver I

I found a simple solution. I used a "missing" op in my aggregation step to detect when null values were present in the data, and then subtracted 1 from the value of a "distinct" aggregation in a later calculate step whenever a null value was present in the series. Sample chart and dataset available at this link in the Vega editor.

Chart below:

sean_cochran_0-1726265049166.png

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (27)