Forum Discussion
Month over year trend
- Anonymous3 years ago
Hi Saumyas ,
You may consider nesting a layer of IF() or SWITCH outside of the measure:Measure = VAR _LEFT = LEFT(MAX('Date'[Column]),2) VAR _RESULT = IF(_LEFT="FY", AVERAGE('Table'[Value]),SUM('Table'[Value])) RETURN _RESULTor
Measure 2 = VAR _LEFT = LEFT(MAX('Date'[Column]),2) VAR _RESULT = SWITCH( _LEFT, "FY",AVERAGE('Table'[Value]), "Ma",SUM('Table'[Value]), "Ap",SUM('Table'[Value]), COUNT('Table'[Value2] ) RETURN _RESULTPlease rewrite the formula as needed.
Best Regards,
Gao
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
Hi, thanks for your reply.
but by this I will get average of all periods, but I need average of only FY 21-22, and sum or count of other months.
Hi Saumyas ,
You may consider nesting a layer of IF() or SWITCH outside of the measure:
Measure =
VAR _LEFT = LEFT(MAX('Date'[Column]),2)
VAR _RESULT = IF(_LEFT="FY", AVERAGE('Table'[Value]),SUM('Table'[Value]))
RETURN
_RESULT
or
Measure 2 =
VAR _LEFT = LEFT(MAX('Date'[Column]),2)
VAR _RESULT =
SWITCH(
_LEFT,
"FY",AVERAGE('Table'[Value]),
"Ma",SUM('Table'[Value]),
"Ap",SUM('Table'[Value]),
COUNT('Table'[Value2]
)
RETURN
_RESULT
Please rewrite the formula as needed.
Best Regards,
Gao
Community Support Team
If 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