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
aiyosap
Helper II
Helper II

Count of Claim Document invoiced more than once

Hi BI community,

 

I am struggle to figure a way to develop the following power BI visual report.

The requirement is indicate in the following diagram and the visual will look like the one on the right. 

The left is the dataset structure.

The report is to count the number of claim document invoiced more than once and claim document invoice only once.

Each claim document can have one or more than one invoice document number. (i.e. invoiced one time or invoiced more than once).

claim doc invoiced more than once.JPG

 

It looks easy but it is not that simple.

Hope you can help with the DAX for the calculate column and measure.

 

Regards,

Aiyosap

 

 

 

1 ACCEPTED SOLUTION
jaideepnema
Solution Sage
Solution Sage

Hi @aiyosap ,

Create a calculated column like this :

Invoice No Count = CALCULATE(DISTINCTCOUNT(InvoiceData[Invoice #]),ALLEXCEPT(InvoiceData,InvoiceData[Claim Doc]))
 
Then create two measures:
Invoiced More than Once = CALCULATE(DISTINCTCOUNT(InvoiceData[Claim Doc]),FILTER(InvoiceData,InvoiceData[Invoice No Count]>1))
 
Invoiced Once = CALCULATE(DISTINCTCOUNT(InvoiceData[Claim Doc]),FILTER(InvoiceData,InvoiceData[Invoice No Count]=1))
 

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

 Connect with me on LinkedIn: https://www.linkedin.com/in/jaideepnema/

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

Create a couple of measures

Invoiced once =
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Claim Doc]),
"@num invoices", CALCULATE( DISTINCTCOUNT( 'Table'[Invoice #] ) )
)
return COUNTROWS( FILTER( summaryTable, [@num invoices] = 1 ) )

Invoiced more than once =
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Claim Doc]),
"@num invoices", CALCULATE( DISTINCTCOUNT( 'Table'[Invoice #] ) )
)
return COUNTROWS( FILTER( summaryTable, [@num invoices] > 1 ) )
jaideepnema
Solution Sage
Solution Sage

Hi @aiyosap ,

Create a calculated column like this :

Invoice No Count = CALCULATE(DISTINCTCOUNT(InvoiceData[Invoice #]),ALLEXCEPT(InvoiceData,InvoiceData[Claim Doc]))
 
Then create two measures:
Invoiced More than Once = CALCULATE(DISTINCTCOUNT(InvoiceData[Claim Doc]),FILTER(InvoiceData,InvoiceData[Invoice No Count]>1))
 
Invoiced Once = CALCULATE(DISTINCTCOUNT(InvoiceData[Claim Doc]),FILTER(InvoiceData,InvoiceData[Invoice No Count]=1))
 

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

 Connect with me on LinkedIn: https://www.linkedin.com/in/jaideepnema/

amitchandak
Super User
Super User

@aiyosap , Try a new measure like

countx(filter(Table, Table[ClaimDoc], "_1", distinctCOUNT(Table[Invoice #])), [_1] >1)

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.