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
rsanyoto
Helper III
Helper III

Challenge Multiple Dax variables and return

Hi guys,

 

my requirement as following:

if productionorder status has value released then calculate the measure called  [VPO2]

if productionorder status has value finished then calculate the measure called [VPO]

 

I tried to create a new VPO MeasureVariabel but its gave an error because a function calcualte has been used in a true/false expression that is used as a table filter expression. this is not allowed

 

VPO MeasureVariabel =
VAR VPOFinished = FILTER(Fact_ProductionOrderLine, Fact_ProductionOrderLine[ProductieStatus] = "released")
VAR VPOReleased = FILTER(Fact_ProductionOrderLine, Fact_ProductionOrderLine[ProductieStatus] = "finished")
RETURN
CALCULATE([VPO 2],VPOReleased,[VPO],VPOFinished )
 
 
Any suggestions to fix/change my VPO MeasureVariabel?
 
Many thanks!
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rsanyoto , Try like

new measure = calculate([VPO2],FILTER(Fact_ProductionOrderLine, Fact_ProductionOrderLine[ProductieStatus] = "released")) +
calculate([VPO],FILTER(Fact_ProductionOrderLine, Fact_ProductionOrderLine[ProductieStatus] = "finished"))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@rsanyoto , Try like

new measure = calculate([VPO2],FILTER(Fact_ProductionOrderLine, Fact_ProductionOrderLine[ProductieStatus] = "released")) +
calculate([VPO],FILTER(Fact_ProductionOrderLine, Fact_ProductionOrderLine[ProductieStatus] = "finished"))

@amitchandak  thanks for your help. Your solution works!

vanessafvg
Super User
Super User

you look like you missing an if statment, if your variable is true then then else 0

ie.

VPO MeasureVariabel =
VAR VPOFinished =
FILTER (
Fact_ProductionOrderLine,
Fact_ProductionOrderLine[ProductieStatus] = "released"
)
VAR VPOReleased =
FILTER (
Fact_ProductionOrderLine,
Fact_ProductionOrderLine[ProductieStatus] = "finished"
)
RETURN
IF ( VPOReleased = 1, [VPO 2], [VPO] )




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.