Forum Discussion
Season Help
- Anonymous3 years ago
Hi Puja ,
You can modify it to the following dax:
When M is selected, the minimum value from January to July of the Season Year is displayed.
When S is selected, the March of Season Year -1 to the April minimum of Season Year are displayed.
Flag = VAR _select = SELECTEDVALUE ( 'Season Table'[Season] ) VAR _year = VALUE ( "20" & "" & RIGHT ( _select, 2 ) ) VAR _code = MAXX ( FILTER ( ALL ( 'Season Table' ), 'Season Table'[Season] = _select ), [Code] ) VAR _MJulyfirst = MINX ( FILTER ( ALL ( 'Date table' ), YEAR ( 'Date table'[Date] ) = _year && MONTH ( 'Date table'[Date] ) = 7 ), [Date] ) VAR _SMarchfirst = MINX ( FILTER ( ALL ( 'Date table' ), YEAR ( 'Date table'[Date] ) = _year && MONTH ( 'Date table'[Date] ) = 3 ), [Date] ) VAR _Smindate = DATE ( _year - 1, 4, 1 ) RETURN SWITCH ( TRUE (), _code = "M" && MAX ( 'Date table'[Date] ) >= DATE ( _year, 1, 1 ) && MAX ( 'Date table'[Date] ) <= _MJulyfirst, 1, _code = "S" && MAX ( 'Date table'[Date] ) >= _Smindate && MAX ( 'Date table'[Date] ) <= _SMarchfirst, 1, 0 )Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi Puja ,
You can modify it to the following dax:
When M is selected, the minimum value from January to July of the Season Year is displayed.
When S is selected, the March of Season Year -1 to the April minimum of Season Year are displayed.
Flag =
VAR _select =
SELECTEDVALUE ( 'Season Table'[Season] )
VAR _year =
VALUE ( "20" & "" & RIGHT ( _select, 2 ) )
VAR _code =
MAXX (
FILTER ( ALL ( 'Season Table' ), 'Season Table'[Season] = _select ),
[Code]
)
VAR _MJulyfirst =
MINX (
FILTER (
ALL ( 'Date table' ),
YEAR ( 'Date table'[Date] ) = _year
&& MONTH ( 'Date table'[Date] ) = 7
),
[Date]
)
VAR _SMarchfirst =
MINX (
FILTER (
ALL ( 'Date table' ),
YEAR ( 'Date table'[Date] ) = _year
&& MONTH ( 'Date table'[Date] ) = 3
),
[Date]
)
VAR _Smindate =
DATE ( _year - 1, 4, 1 )
RETURN
SWITCH (
TRUE (),
_code = "M"
&& MAX ( 'Date table'[Date] ) >= DATE ( _year, 1, 1 )
&& MAX ( 'Date table'[Date] ) <= _MJulyfirst, 1,
_code = "S"
&& MAX ( 'Date table'[Date] ) >= _Smindate
&& MAX ( 'Date table'[Date] ) <= _SMarchfirst, 1,
0
)
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi Anonymous ,
I just noticed one limitation,
When I select S23, should show , 2022 April until 2023 March.
But I see blanks. Any thoughts ?