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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Count dimentions with missing values (Desktop May2019 for report server)

I have two tables with one to many relationship and crossfilter direction set to "both".

 

DimDimention (has DimentionID-s) 1 - * DimDimentionUser (has DimentionID's and UserID's)

 

I need to calculate the number of dimentions that do not have a user, i.e. count DimDimention ID's when that DimDimentionID is missing from DimDimentionUser.

 

I wanted to use the following formulas, however the Desktop version is May2019 for the Reporting Server and does not have  SELECTEDCOLUMNS, EXCEPT, ISEMPTY formulas.

 

The following formula does not work either

calculate(

distinccount(DimDimentionId);

filter(DimDimentionUser, isblank(DimDimentionUser[DimentionId])

)

 

Any ideas how to solve this with a calculated measure?

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,


How about the result after you follow the suggestions in other's post? if your ploblem does not resolved, You could also try the following formula.

 

Count =
DISTINCTCOUNT ( DimDimentionID[DimentionId] )
    - CALCULATE (
        DISTINCTCOUNT ( DimDimentionID[DimentionId] ),
        FILTER ( ALL ( 'DimDimentionUser' ), [DimentionId] & "" <> "" )
    )

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,


How about the result after you follow the suggestions in other's post? if your ploblem does not resolved, You could also try the following formula.

 

Count =
DISTINCTCOUNT ( DimDimentionID[DimentionId] )
    - CALCULATE (
        DISTINCTCOUNT ( DimDimentionID[DimentionId] ),
        FILTER ( ALL ( 'DimDimentionUser' ), [DimentionId] & "" <> "" )
    )

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

The measure gives  the right calculation, so is correct.

Unfortunately, it does not help to find the DimId-s without a user (i.e. does not show the right values on rows), as I need to also get a list of them.

As no DAX solutions was found I went ahead of adding a "Count User" column to the original SQL data via SQL. 

Hi @Anonymous ,

 

The formula is purpose to find total count of the dimentions without user, If you need to get the ID list, we can try the following solution:

 

Put the DimID Column  of DimDimension Table into a table visual, Create a measure and put into the visual Filter.

 

HasUser = DISTINCTCOUNT('DimDimensionUsers')

 

Then we can set the HasUser greater than zero to archieve your requirement.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

As they are crossfiltered the Users with no  Domentions are not shown, i.e. the measures gives 1 on all rows.

JirkaZ
Solution Specialist
Solution Specialist

@Anonymous You can add a column to the DimDimension using COUNTROWS(RELATEDTABLE(DimDimensionUser)). Then just count the rows that have 0

 

Anonymous
Not applicable

@JirkaZ, unfortunately the calculated column does not offer me the "countrows" formula (i'm using DirectQuery)

JirkaZ
Solution Specialist
Solution Specialist

@Anonymous COUNTROWS should be available for use in measures even in DirectQuery mode 
https://docs.microsoft.com/en-us/analysis-services/tabular-models/dax-formula-compatibility-in-directquery-mode-ssas-2016

 

As a single measure you could maybe calculate it like:
Count without child := CALCULATE(Countrows(DimDimension) - CALCULATE(Countrows(DimDimension), FILTER(DimDimension(Id) = DimDimensionUsers(ParentId))))

Anonymous
Not applicable

COUNTROWS is offered only in measures and not in columns in case of by Desktop version (for the purpose of report Server) - in yhr compatibility link you've sent it's shown under "measures and query only".

 

In the formula, the filter does not recognize the DimentionUser value as related, because of the one to many relationship.

JirkaZ
Solution Specialist
Solution Specialist

@Anonymous I was blind the whole time Smiley Happy

I guess we can assume referential integrity. So the formula for the unused Dims could be:

 

UnusedDims = CALCULATE(COUNTROWS(DimDimension) - COUNTROWS(VALUES(DimDimensionUsers[DimID])))
Anonymous
Not applicable

@JirkaZ,Will this work as a measure?

JirkaZ
Solution Specialist
Solution Specialist

The first part has to be a column in the DimDimension. The countrows part can be a Measure.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors