Forum Discussion
AllanBerces
1 year agoPost Prodigy
Calculated Column to Measure
Hi Good day, Can anyone pls need your help on how can i change my calculated column into a measure (Column Highligthed in Yellow) https://docs.google.com/spreadsheets/d/1Pw4VzygHbSKlhDTo35rFaMj...
- Anonymous1 year ago
Hi, AllanBerces
Please try this, the data you gave does not have the used_AREA field, so there is no way to verify the accuracy of this formula.SUM_NPT_by_Vessel/Wk_Measure = VAR _vessel = SELECTEDVALUE(TRS[Vessel]) VAR _weekno = SELECTEDVALUE(TRS[WeekNo:]) VAR _used_AREA = SELECTEDVALUE(TRS[used_AREA]) VAR _type = SELECTEDVALUE(TRS[Type]) VAR _re =IF(_type = "Direct", CALCULATE(SUM(TRS[NPTHrs]),FILTER(ALL(TRS),TRS[Vessel] = _vessel && TRS[WeekNo:] = _weekno && TRS[used_AREA] = _used_AREA) )) RETURN _reBest Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
AllanBerces
1 year agoPost Prodigy
Hi,
Below are my dax for my calculated Column
SUM_NPTCODE =
SUMX (
FILTER (
SUMMARIZECOLUMNS (
'TRS'[Vessel],
'TRS'[WeekNo:],
'TRS'[NPTHrs],
'TRS'[NPT Code]
),
'TRS'[Vessel] = EARLIER ( 'TRS'[Vessel] )
&& 'TRS'[WeekNo:] = EARLIER ( 'TRS'[WeekNo:] )
&& 'TRS'[NPT Code] = EARLIER ( 'TRS'[NPT Code] )
&& TRS[Type] <> "Direct"
),
'TRS'[NPTHrs]
)
SUM_NPT_by_Vessel/Wk =
SUMX (
FILTER (TRS,
'TRS'[Vessel] = EARLIER ( 'TRS'[Vessel] )
&& 'TRS'[used_AREA] = EARLIER ( 'TRS'[used_AREA] )
&& 'TRS'[WeekNo:] = EARLIER ( 'TRS'[WeekNo:] )
&& TRS[Type] <> "Direct"
),
'TRS'[NPTHrs]
)
Thank you