Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Here is the entire expression:
=If((vMeasure) = 'EquivPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(=$(vYear))'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(=$(vYear))'}>}EquivalentUnits),'$##.00'))
,
If((vMeasure) = 'CartonPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(=$(vYear))'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(=$(vYear))'}>}CartonEquiv),'$##.00')),
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(=$(vYear))'}>}$(vMeasure)),'#,##0'))
)
)
Here is how it evaluates in the error panel:
It appears that all variables are evaluated correctly, and when I get out of the Edit mode, the results look good in the table, even after changing multiple variables to other values.
Is there a way to correct this?
Updated it as follows and now it works:
=If((vMeasure) = 'EquivPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}EquivalentUnits),'$##.00'))
,
If((vMeasure) = 'CartonPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}CartonEquiv),'$##.00')),
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},[Week]={'$(vWeek)'},ShipYear={'$(vYear)'}>}$(vMeasure)),'#,##0'))
)
)
Updated it as follows and now it works:
=If((vMeasure) = 'EquivPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}EquivalentUnits),'$##.00'))
,
If((vMeasure) = 'CartonPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Mon'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}CartonEquiv),'$##.00')),
(Num(Sum({<ShipDate_DayOfWeek={'Mon'},[Week]={'$(vWeek)'},ShipYear={'$(vYear)'}>}$(vMeasure)),'#,##0'))
)
)