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

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
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.