Forum Discussion
Help with VAR formula
Hello
I have a functioning measure that refers to several measures from outside. This is the functioning measure
Projected Cost (Input):=If(HASONEVALUE('Job-Phase'[JHP_OBJECT_ORASEQ]),[Old Projected Cost (Input)],SUMX(VALUES('Job-Phase'[JHP_OBJECT_ORASEQ]),CALCULATE(([Old Projected Cost (Input)]))))
I am trying to bring in the Old Projected Cost(input) as variable in the new formula
VAR ProjectedQuantitywithfilter =
IF (
[Quantity] > [Actual Output Quantity - To Date],
[Quantity],
[Actual Output Quantity - To Date]
)
VAR RemainingQty = ProjectedQuantitywithfilter - [Actual Output Quantity - To Date]
VAR ProjectedCostInputwithfiltercontext =
IF (
( RemainingQty * [Unit Cost - To Date] ) + [Actual Input Cost - To Date] = 0,
[Current Budget Cost (Input)] + [Unposted PCI Cost (Input)],
( RemainingQty * [Unit Cost - To Date] ) + [Actual Input Cost - To Date]
)
VAR ProjectedCostInputwithoutfiltercontext =
SUMX (
VALUES ( 'Job-Phase'[JHP_OBJECT_ORASEQ] ),
CALCULATE ( ProjectedCostInputwithfiltercontext )
)
RETURN
IF (
HASONEVALUE ( 'Job-Phase'[JHP_OBJECT_ORASEQ] ),
ProjectedCostInputwithfiltercontext,
ProjectedCostInputwithoutfiltercontext
)
2 Replies
- v-piga-msftResident Rockstar
Hi svishwanathan ,
I still have a little confused about your scenario, which measure do you have problem? Projected Cost2(Input) or Old Projected Cost(input) as variable ?
It seems that there is no syntax error for your formulas.
If it is convenient could you share some data sample and your desired output so that we could help further on it? Or, ideally, share the pbix (beware of confidential data)
Best Regards,
Cherry
- v-piga-msftResident Rockstar
Hi svishwanathan ,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please share your data sample so that I could make a test on it.
Best Regards,
Cherry