Forum Discussion
Anonymous
4 years agoNot applicable
Help please! Operating with values in one column (for different months)
Hi Community! I'm new here, and I would very much appreciate if you can help me with this (probably simple) situation. I have a table that looks like this: And I need to show a visu...
- 4 years ago
Hi Anonymous
Here is a sample file with the solution https://we.tl/t-209bVq49gJSalaies = VAR CurrentValue = SUM ( Payroll[salary] ) VAR MinDate = CALCULATE ( MIN ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) ) VAR MaxDate = CALCULATE ( MAX ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) ) VAR FirstValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MinDate ) VAR LastValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MaxDate ) RETURN IF ( HASONEVALUE ( Payroll[dim_time] ), CurrentValue, FORMAT ( DIVIDE ( LastValue - FirstValue, FirstValue ), "Percent" ) )
tamerj1
Community Champion
4 years agoHi Anonymous
Here is a sample file with the solution https://we.tl/t-209bVq49gJ
Salaies =
VAR CurrentValue = SUM ( Payroll[salary] )
VAR MinDate = CALCULATE ( MIN ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) )
VAR MaxDate = CALCULATE ( MAX ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) )
VAR FirstValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MinDate )
VAR LastValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MaxDate )
RETURN
IF (
HASONEVALUE ( Payroll[dim_time] ),
CurrentValue,
FORMAT ( DIVIDE ( LastValue - FirstValue, FirstValue ), "Percent" )
)