Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello, I am looking to compare different periods of data with 3 date slicers (Year, Quarter, Month)
Below is an example of a data sample along with the scenarios I am looking to accomplish.
Solved! Go to Solution.
Hi @shaebert ,
Based on your description, you can do some steps as follows.
1. Create a calendar table.
Calendar = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Quarter",QUARTER([Date]),"Month",MONTH([Date]))
2. Create the relationship between "calendar[Date]" and "Test[Date]".(1:*)
3. Create "year", "quarter" and "month" slicers.
4. Create two measures and select the "Card" visual.
# of leads = SUM('Test'[Leads])
Previous period =
var year=SELECTEDVALUE('Calendar'[Year])
var quarter=SELECTEDVALUE('Calendar'[Quarter])
var month=SELECTEDVALUE('Calendar'[Month])
return
IF(
month=BLANK(),
IF(
quarter=BLANK(),
IF(
year=BLANK(),
"N/A",
SUMX(FILTER(ALL('Test'),YEAR([Date])=year-1),[Leads])
),
SUMX(FILTER(ALL('Test'),YEAR([Date])=year&&QUARTER([Date])=quarter-1),[Leads])
),
SUMX(FILTER(ALL('Test'),YEAR([Date])=year&&MONTH([Date])=month-1),[Leads])
)
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @shaebert ,
Based on your description, you can do some steps as follows.
1. Create a calendar table.
Calendar = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Quarter",QUARTER([Date]),"Month",MONTH([Date]))
2. Create the relationship between "calendar[Date]" and "Test[Date]".(1:*)
3. Create "year", "quarter" and "month" slicers.
4. Create two measures and select the "Card" visual.
# of leads = SUM('Test'[Leads])
Previous period =
var year=SELECTEDVALUE('Calendar'[Year])
var quarter=SELECTEDVALUE('Calendar'[Quarter])
var month=SELECTEDVALUE('Calendar'[Month])
return
IF(
month=BLANK(),
IF(
quarter=BLANK(),
IF(
year=BLANK(),
"N/A",
SUMX(FILTER(ALL('Test'),YEAR([Date])=year-1),[Leads])
),
SUMX(FILTER(ALL('Test'),YEAR([Date])=year&&QUARTER([Date])=quarter-1),[Leads])
),
SUMX(FILTER(ALL('Test'),YEAR([Date])=year&&MONTH([Date])=month-1),[Leads])
)
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |