Forum Discussion
Summarize Quick Measure Month-over-Month
- Anonymous4 years ago
Hi jrpallares89 ,
Please try to update the formula of measure [Margen Real--MoM2] as below and check whether it can return the correct result.
Margen Real--MoM2 = VAR _selyear = SELECTEDVALUE ( 'Calendar'[Date].[Year] ) VAR _selmonth = SELECTEDVALUE ( 'Calendar'[Date].[MonthNo] ) VAR _preldate = DATE ( _selyear, _selmonth, 1 ) - 1 VAR __PREV_MONTH = CALCULATE ( SUM ( 'ClosingSAP'[Margen Real--2022] ), FILTER ( ALLSELECTED ( 'ClosingSAP' ), YEAR ( 'ClosingSAP'[Date] ) = YEAR ( _preldate ) && MONTH ( 'ClosingSAP'[Date] ) = MONTH ( _preldate ) ) ) RETURN IF ( __PREV_MONTH > SUM ( 'ClosingSAP'[Margen Real--2022] ), BLANK (), SUM ( 'ClosingSAP'[Margen Real--2022] ) - __PREV_MONTH )If the above one can't help you get the desired result, please provide some sample data in your table ClosingSAP (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi jrpallares89 ,
Please try to update the formula of measure [Margen Real--MoM2] as below and check whether it can return the correct result.
Margen Real--MoM2 =
VAR _selyear =
SELECTEDVALUE ( 'Calendar'[Date].[Year] )
VAR _selmonth =
SELECTEDVALUE ( 'Calendar'[Date].[MonthNo] )
VAR _preldate =
DATE ( _selyear, _selmonth, 1 ) - 1
VAR __PREV_MONTH =
CALCULATE (
SUM ( 'ClosingSAP'[Margen Real--2022] ),
FILTER (
ALLSELECTED ( 'ClosingSAP' ),
YEAR ( 'ClosingSAP'[Date] ) = YEAR ( _preldate )
&& MONTH ( 'ClosingSAP'[Date] ) = MONTH ( _preldate )
)
)
RETURN
IF (
__PREV_MONTH > SUM ( 'ClosingSAP'[Margen Real--2022] ),
BLANK (),
SUM ( 'ClosingSAP'[Margen Real--2022] ) - __PREV_MONTH
)
If the above one can't help you get the desired result, please provide some sample data in your table ClosingSAP (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- jrpallares894 years agoNew Member
Thanks a lot!
It works!