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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Divide with filters error

Hallo,

I've got a problem with this table.

 

https://www.dropbox.com/s/ii6q02bn9kltvef/Cartel1.xlsx?dl=0 

 

iN this file we have are 2 tables:

1: Carico_4

2: Carico_uph

 

Ive made the second table with this formulas:

Carico_uph = summarize(Carico_4, Carico_4[Date], Carico_4[Ore], Carico_4[CIRCUITO], "op nr", distinctcount(Carico_4[MATRICOLA]), "contenitori",count(Carico_4[CONTENITORE]))
 
In Power Bi desktop, I filled in the filter  for all pages = 14 Aug
TARGET: have in table 2 a formula DAX--> SUM of total "CONTENITORE" divided total "OP NR", filtered for CIRCUITO=XD or XK, and with the filter in all pages applied
 
Here what I've done till now, for it:
UPH_XD = divide(calculate(sum(Carico_uph[contenitori]), filter(Carico_uph, Carico_uph[CIRCUITO]="XD")), calculate(sum(Carico_uph[op nr]), filter(Carico_uph,Carico_uph[CIRCUITO]="XD")))
 
but it doesn't work. I think it doesn't apply the filter in all page.
Do you have a trick to solve it?
1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Try modifying your DAX as follows:

UPH_XD = divide(

calculate(sum(Carico_uph[contenitori]), filter(ALLSELECTED(Carico_uph), Carico_uph[CIRCUITO]="XD")), calculate(sum(Carico_uph[op nr]), filter(ALLSELECTED(Carico_uph),Carico_uph[CIRCUITO]="XD")), 0

)

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

2 REPLIES 2
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Try modifying your DAX as follows:

UPH_XD = divide(

calculate(sum(Carico_uph[contenitori]), filter(ALLSELECTED(Carico_uph), Carico_uph[CIRCUITO]="XD")), calculate(sum(Carico_uph[op nr]), filter(ALLSELECTED(Carico_uph),Carico_uph[CIRCUITO]="XD")), 0

)

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi

I filled in ur formula:

UPH_XD = divide(

calculate(sum(Carico_uph[contenitori]), filter(ALLSELECTED(Carico_uph), Carico_uph[CIRCUITO]="XD" || Carico_uph[CIRCUITO]="XK")), calculate(sum(Carico_uph[op nr]), filter(ALLSELECTED(Carico_uph),Carico_uph[CIRCUITO]="XD" || Carico_uph[CIRCUITO]="XK")), 0

)
But the output is wrong yet
tot contenitori: 546
ttot op nr= 88
it should be 6,2 but it is 8,28

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.