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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Dax to create a summary card based on rows distinct row count selected to a table

Dax to create a summary card based on rows distinct row count selected to a table

 

Olajumi_0-1627662631739.png

 

 

I need two Dax measures to:

1. Create a summary card "Total codes used by firm for all clients" to be the distinct count of column "Codes used by firm" 

2. Create a summary card "Total number of codes used by all firms" to be the distinct count of column "potential codes that can be billed" 

 

Rules:

The requirement is that the columns in table are distinct count of taskcodes used.   

The table  "report ProducerConsumerTaskCodes"  is a subset of "report ConsumerTaskCodes".

 

Card "Total codes used by firm for all clients"  is from table "report ProducerConsumerTaskCodes"  

Card  "Total number of codes used by all firms"  is from table "report ConsumerTaskCodes".

 

Card "Total codes used by firm for all clients"  is not expected to be equal to the sum of rows in "codes used by firm" because only unique codes aggregated.  

Also, 

Card "Total number of codes used by all firms" is not expected to be equal to the sum of rows in  "Codes used by firm" because only unique codes are aggregated.     

 

Note:  One of the conditions for clients to be included in the table is that Total confidence score for the client must be greater than 50.   See visual filter.  This condition is expected to also apply to the summary card measure.  

 

PBIX:

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@v-xiaotang v-xiaotang

 

Unfortunately, the the issue could not be reproduced with the datset sampple.  I have a new updated PBIX and screenshot here ....

 

 

Olajumi_1-1627661503130.png

 

The expected result is as highlighted.

 

New PBIX:

 

https://1drv.ms/u/s!AlMdRxAveLesgcFkieztImY35wvHmA?e=7nlkgN

 

View solution in original post

Hi @Anonymous 

try this

*Total producerConsumerTask codes grouped = CALCULATE(DISTINCTCOUNT('report producerConsumerTaskCodes'[TaskCode]),FILTER(Consumer,[*Qualify for taskcode report]="Yes"),FILTER(DimDate,DimDate[Calendar]>=[*Visual start month] && DimDate[Calendar] <= [*Visual end month] 
))
*Total ConsumerTask codes grouped =  CALCULATE(DISTINCTCOUNT(('report ConsumerTaskCodes'[TaskCode])),FILTER(Consumer,[*Qualify for taskcode report]="Yes"),FILTER(DimDate,DimDate[Calendar]>=[*Visual start month] &&DimDate[Calendar] <= [*Visual end month]
))

 

vxiaotang_0-1627979443533.png

 

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@v-xiaotang v-xiaotang

 

Unfortunately, the the issue could not be reproduced with the datset sampple.  I have a new updated PBIX and screenshot here ....

 

 

Olajumi_1-1627661503130.png

 

The expected result is as highlighted.

 

New PBIX:

 

https://1drv.ms/u/s!AlMdRxAveLesgcFkieztImY35wvHmA?e=7nlkgN

 

Hi @Anonymous 

have I soved your question? could you mark my answer as the solution? thx.

 

 

Regards,

Community Support Team _Tang

Hi @Anonymous 

try this

*Total producerConsumerTask codes grouped = CALCULATE(DISTINCTCOUNT('report producerConsumerTaskCodes'[TaskCode]),FILTER(Consumer,[*Qualify for taskcode report]="Yes"),FILTER(DimDate,DimDate[Calendar]>=[*Visual start month] && DimDate[Calendar] <= [*Visual end month] 
))
*Total ConsumerTask codes grouped =  CALCULATE(DISTINCTCOUNT(('report ConsumerTaskCodes'[TaskCode])),FILTER(Consumer,[*Qualify for taskcode report]="Yes"),FILTER(DimDate,DimDate[Calendar]>=[*Visual start month] &&DimDate[Calendar] <= [*Visual end month]
))

 

vxiaotang_0-1627979443533.png

 

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

v-xiaotang
Community Support
Community Support

Hi @Anonymous 

so what's the expected result of this sample?

vxiaotang_0-1627624035200.png

in the picture, distinct count of column "Codes used by firm"= 4? and distinct count of column "potential codes that can be billed" = 4? ( I doubt if I understood correctly...😂

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.