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

how to pick a denominator from a table

Hello 

 

I have a huge table which contains invoice number per batch such as  below

 

id    batch  invoice  lockbox  Nbinvoiceperbatch

1        a         a101      201         150

2        a         a106       201         150

...

100    a        a205        201           150

 

101    b        b25           201           60

102    b         b 28         201           60

...

and so on

I am able to make a key measure to calculate the number of distinct invoice per batch using the following dax

No of posted invoices=calculate(

distinctcount(Table1,table1[invoice]),filter (table1[batch] && table1[lockbox]))

 

This should give me the number of invoice in each lockbox that we find in a batch.

the I would like to get the denominator which is the number of invoice per batch ex; 150, 60

 

How is it possible to define a measure which give the number of invoice per batch (value available into the table)

 

Then I would like to make a ratio such as divide(number of distinct invoice, number of invoice per batch, 0) 

Does someone know how to do that

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

OK, here is what I did, three measures:

 

No of posted invoices = DISTINCTCOUNT('Table'[invoice])

Denominator = AVERAGEX('Table',[Nbinvoiceperbatch])

Ratio = DIVIDE([No of posted invoices],[Denominator],0)

 

PBIX file attached. No that is not a typo in the file name! 🙂 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , is you issue resolved by the solution provided by @Greg_Deckler . If not provide what is the issue you are facing with some more details.

Greg_Deckler
Super User
Super User

OK, here is what I did, three measures:

 

No of posted invoices = DISTINCTCOUNT('Table'[invoice])

Denominator = AVERAGEX('Table',[Nbinvoiceperbatch])

Ratio = DIVIDE([No of posted invoices],[Denominator],0)

 

PBIX file attached. No that is not a typo in the file name! 🙂 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

OK, I am going to take a look at this but that DAX does not appear to be in any way correct. DISTINCTCOUNT does not take 2 parameters. And FILTER takes a table argument first, not a column reference.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

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.