Forum Discussion
How to calculate Growth based on multiple dimension
- 6 years ago
Hi, immkhan
Based on your description, I created data to reproduce your scenario.
Test:
Calendar:
Calendar = CALENDARAUTO()There is a one-to-one relationship between two 'Calendar' and 'Table'.
You may create a measure as below.
PeriodValue = var _period = SELECTEDVALUE(Test[Period]) return IF( _period = "Current year", CALCULATE( SUM('Table'[Value]), DATESYTD('Calendar'[Date]) ), IF( _period = "Last year", CALCULATE( SUM('Table'[Value]), DATESYTD(SAMEPERIODLASTYEAR('Calendar'[Date])) ), IF( _period = "Last five years", CALCULATE( SUM('Table'[Value]), DATESINPERIOD( 'Calendar'[Date], LASTDATE('Calendar'[Date]), -5, YEAR ) ) ) ) )You may also use other dimensions as slicers to filter the result. Here are the results.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, immkhan
Based on your description, I created data to reproduce your scenario.
Test:
Calendar:
Calendar = CALENDARAUTO()
There is a one-to-one relationship between two 'Calendar' and 'Table'.
You may create a measure as below.
PeriodValue =
var _period = SELECTEDVALUE(Test[Period])
return
IF(
_period = "Current year",
CALCULATE(
SUM('Table'[Value]),
DATESYTD('Calendar'[Date])
),
IF(
_period = "Last year",
CALCULATE(
SUM('Table'[Value]),
DATESYTD(SAMEPERIODLASTYEAR('Calendar'[Date]))
),
IF(
_period = "Last five years",
CALCULATE(
SUM('Table'[Value]),
DATESINPERIOD(
'Calendar'[Date],
LASTDATE('Calendar'[Date]),
-5,
YEAR
)
)
)
)
)
You may also use other dimensions as slicers to filter the result. Here are the results.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- immkhan6 years agoFrequent Visitor
can you share that sample .pbix file
- v-alq-msft6 years ago
Community Support
Hi, immkhan
Here is the pbix .
Best RegardsAllan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.