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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.