Forum Discussion
Sort Order with Time intelligence - Fiscal year
- 7 years ago
Hi chanal,
You can create measures below:
DiffBalance = VAR predate = CALCULATE ( MAX ( 'Table2'[FiscalYear] ), FILTER ( ALL ( Table2 ), 'Table2'[Compte] = MAX ( Table2[Compte] ) && 'Table2'[FiscalYear] < MAX ( Table2[FiscalYear] ) ) ) VAR preBalance = CALCULATE ( MAX ( Table2[Balance] ), FILTER ( ALL ( 'Table2' ), 'Table2'[Compte] = MAX ( Table2[Compte] ) && 'Table2'[FiscalYear] = predate ) ) RETURN IF ( ISINSCOPE ( Table2[FiscalYear] ), IF ( predate = BLANK (), BLANK (), MAX ( Table2[Balance] ) - preBalance ), SUM ( Table2[Balance] ) - CALCULATE ( SUM ( Table2[Balance] ), FILTER ( ALL ( 'Table2' ), 'Table2'[FiscalYear] = MIN ( 'Table2'[FiscalYear] ) && Table2[Compte] = MAX ( Table2[Compte] ) ) ) )Diff% = VAR predate = CALCULATE ( MAX ( 'Table2'[FiscalYear] ), FILTER ( ALL ( Table2 ), 'Table2'[Compte] = MAX ( Table2[Compte] ) && 'Table2'[FiscalYear] < MAX ( Table2[FiscalYear] ) ) ) VAR preBalance = CALCULATE ( MAX ( Table2[Balance] ), FILTER ( ALL ( 'Table2' ), 'Table2'[Compte] = MAX ( Table2[Compte] ) && 'Table2'[FiscalYear] = predate ) ) RETURN IF ( ISINSCOPE ( Table2[FiscalYear] ), IF ( predate = BLANK (), BLANK (), DIVIDE ( MAX ( Table2[Balance] ) - preBalance, preBalance ) ), DIVIDE ( SUM ( Table2[Balance] ) - CALCULATE ( SUM ( Table2[Balance] ), FILTER ( ALL ( 'Table2' ), 'Table2'[FiscalYear] = MIN ( 'Table2'[FiscalYear] ) && Table2[Compte] = MAX ( Table2[Compte] ) ) ), CALCULATE ( SUM ( Table2[Balance] ), FILTER ( ALL ( 'Table2' ), 'Table2'[FiscalYear] = MIN ( 'Table2'[FiscalYear] ) && Table2[Compte] = MAX ( Table2[Compte] ) ) ) ) )>> Plus: I do not like when you have Column blank for the 1st year change. => how to remove this column with nothing in it?
Currently, there is no OOTB feature for to achieve this requirement. To work around the issue, we can turn off Word Wrap option for column headers, then decrease column header width for these blank columns.
You can test with attached pbix file.
Best Regards,
Qiuyun Yu
Hi chanal,
You can create measures below:
DiffBalance =
VAR predate =
CALCULATE (
MAX ( 'Table2'[FiscalYear] ),
FILTER (
ALL ( Table2 ),
'Table2'[Compte] = MAX ( Table2[Compte] )
&& 'Table2'[FiscalYear] < MAX ( Table2[FiscalYear] )
)
)
VAR preBalance =
CALCULATE (
MAX ( Table2[Balance] ),
FILTER (
ALL ( 'Table2' ),
'Table2'[Compte] = MAX ( Table2[Compte] )
&& 'Table2'[FiscalYear] = predate
)
)
RETURN
IF (
ISINSCOPE ( Table2[FiscalYear] ),
IF ( predate = BLANK (), BLANK (), MAX ( Table2[Balance] ) - preBalance ),
SUM ( Table2[Balance] )
- CALCULATE (
SUM ( Table2[Balance] ),
FILTER (
ALL ( 'Table2' ),
'Table2'[FiscalYear] = MIN ( 'Table2'[FiscalYear] )
&& Table2[Compte] = MAX ( Table2[Compte] )
)
)
)
Diff% =
VAR predate =
CALCULATE (
MAX ( 'Table2'[FiscalYear] ),
FILTER (
ALL ( Table2 ),
'Table2'[Compte] = MAX ( Table2[Compte] )
&& 'Table2'[FiscalYear] < MAX ( Table2[FiscalYear] )
)
)
VAR preBalance =
CALCULATE (
MAX ( Table2[Balance] ),
FILTER (
ALL ( 'Table2' ),
'Table2'[Compte] = MAX ( Table2[Compte] )
&& 'Table2'[FiscalYear] = predate
)
)
RETURN
IF (
ISINSCOPE ( Table2[FiscalYear] ),
IF (
predate = BLANK (),
BLANK (),
DIVIDE ( MAX ( Table2[Balance] ) - preBalance, preBalance )
),
DIVIDE (
SUM ( Table2[Balance] )
- CALCULATE (
SUM ( Table2[Balance] ),
FILTER (
ALL ( 'Table2' ),
'Table2'[FiscalYear] = MIN ( 'Table2'[FiscalYear] )
&& Table2[Compte] = MAX ( Table2[Compte] )
)
),
CALCULATE (
SUM ( Table2[Balance] ),
FILTER (
ALL ( 'Table2' ),
'Table2'[FiscalYear] = MIN ( 'Table2'[FiscalYear] )
&& Table2[Compte] = MAX ( Table2[Compte] )
)
)
)
)
>> Plus: I do not like when you have Column blank for the 1st year change. => how to remove this column with nothing in it?
Currently, there is no OOTB feature for to achieve this requirement. To work around the issue, we can turn off Word Wrap option for column headers, then decrease column header width for these blank columns.
You can test with attached pbix file.
Best Regards,
Qiuyun Yu
Thank you so much for your answer !!!😀
Best regards