Forum Discussion
Comparing the same variable for two points in time from one data set
- 2 years ago
You need two date tables so that you can select 2 different date ranges using 2 slicers. The below can be achieved through filtering on two different date columns (while it might be possible for one date column and one date table, this isn't best practice so using 2 date tables is best)
I'm unsure what you mean by joining? if you mean creating a relationship, then yes you will need to create an inactive relationship between the two calendar and also one (active) relationship between one of the calendar tables and your month column.
You can pretty much just copy the code from the article i linked earlier, and change the name.
i.e for sales:
Sales = SUM(Table[Sales]) // this will take the date range selected in the table with the active relationshipand
Comparison Sales := CALCULATE ( [Sales], ALL ( 'Calendar' ), USERELATIONSHIP ( 'Calendar'[Date], 'Other Calendar'[Date] ) ) // this will take the date range selected in the other slicer
You need two date tables so that you can select 2 different date ranges using 2 slicers. The below can be achieved through filtering on two different date columns (while it might be possible for one date column and one date table, this isn't best practice so using 2 date tables is best)
I'm unsure what you mean by joining? if you mean creating a relationship, then yes you will need to create an inactive relationship between the two calendar and also one (active) relationship between one of the calendar tables and your month column.
You can pretty much just copy the code from the article i linked earlier, and change the name.
i.e for sales:
Sales = SUM(Table[Sales]) // this will take the date range selected in the table with the active relationship
and
Comparison Sales :=
CALCULATE (
[Sales],
ALL ( 'Calendar' ),
USERELATIONSHIP ( 'Calendar'[Date], 'Other Calendar'[Date] )
) // this will take the date range selected in the other slicerActually - by referencing the [Sales] with my source table as in sum('Source'[required column]) it seems to work... Let me muck around with it a bit more, and if it works I'll accept your solution 🙂