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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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