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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SL_1983
Helper II
Helper II

If function in a measure with multiple conditions

Good morning,

 

I have the following calculated columns:

Number of Packages 4 pax = if('Ingredients'[Qty] <= 'Ingredients'[Package Content];1;2)

Number of Packages 3 pax = if(('Ingredients'[Qty]/4)*3 <= 'Ingredients'[Package Content];1;2)

Number of Packages 2 pax = if(('Ingredients'[Qty]/4)*2 <= 'Ingredients'[Package Content];1;2)

Number of Packages 1 pax = if(('Ingredients'[Qty]/4) <= 'Ingredients'[Package Content];1;2)

 

Is there any way to make one measure for this instead of 4 calculated columns?

 

Thanks for your help.

 

Kind regards

 

 

1 ACCEPTED SOLUTION

Hi @SL_1983 

 

Can you try changing that measure to below (you will not need the 4 columns you created):

 

Kostprijs Per Aangekochte Verpakking = SUMX ('Ingrediënten', ('Ingrediënten'[Verpakking Gewicht Laagste Prijs] * IF(( 'Ingrediënten'[Recept Hoeveelheid 4 Personen] / 4 ) * SELECTEDVALUE ( 'Slicer Table'[Recept  aantal Personen] ) <= 'Ingrediënten'[Verpakking Gewicht Laagste Prijs], 1, 2)) * RELATED ( 'Product'[Goedkoopste Prijs] ))

 

Hope that helps! 

View solution in original post

3 REPLIES 3
bheepatel
Resolver IV
Resolver IV

Hi @SL_1983 

 

Can you please provide a sample of your dataset and the desired output?

Hello,

 

This is the link to the pbix file (however it is in Dutch): https://1drv.ms/u/s!AuaqHTxLCZ_h0wB8UX412RXRsm88?e=iMha2O

 

The 4 colums have been created in the table Ingrediënten. 

Then I created a measure: "Kostprijs Per Aangekochte Verpakking" to be able to calculate the cost of the recipe based on the number of packages that have to be bought to make the dish.

 

Kind regards,

 

Hi @SL_1983 

 

Can you try changing that measure to below (you will not need the 4 columns you created):

 

Kostprijs Per Aangekochte Verpakking = SUMX ('Ingrediënten', ('Ingrediënten'[Verpakking Gewicht Laagste Prijs] * IF(( 'Ingrediënten'[Recept Hoeveelheid 4 Personen] / 4 ) * SELECTEDVALUE ( 'Slicer Table'[Recept  aantal Personen] ) <= 'Ingrediënten'[Verpakking Gewicht Laagste Prijs], 1, 2)) * RELATED ( 'Product'[Goedkoopste Prijs] ))

 

Hope that helps! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors