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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.