Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi all!
Sorry for the long post but I am kinda stuck at the moment. Hear me out.
I am developing a report that has the following requirements:
1. 2 slicers (Slicer A & Slicer B),
2. 2 date ranges for the custom options in Slicers A and B,
3. 6 card visuals, and 3 filters
Field used for Card Visual 1 : Column ABC
Field used for Card Visual 2: Column DEF (this is basically column ABC but I created a measure to capture its data separately and use for Card Visual 2)
The goal of the report is to have 2 separate values that will display on the Card Visuals. For example, if user selects Last 7 Days in Slicer 1 and Month over Month in Slicer 2, the Card 1 will show total values from the last 7 days while Card 2 will show the last 7 days total but 1 month prior, etc. Also, the date range slicers will only be usable if the CUSTOM option is selected for each slicer.
I tried these ff approaches:
Approach 1: Hard coding all (including the date ranges) inside the measures
1. Hard code the calculations inside the measures used for Card Visuals 1 & 2,
2. Create a dummy table for Slicers A and B to contain the fields that will serve as switch case triggers for the hard-coded values.
Initially I thought this is good but I had an issue on the Custom option.However I could not make this calculation work when trying to get the Month over Month / Year over Year values. (I am using DAX function PARALLELPERIOD in Slicer B. )
Here is the calculation I used for capturing Custom in Slicer A.
Note: I used DAX function USERELATIONSHIP in capturing the value for Custom in Slicer A. Part of the goal is that the date range will only function once Custom is selected in Slicer A. This is the part where I am stuck in this approach.
Approach 2: Use calculation groups
I tried to use calculation groups using the same logic I did in Approach 1.
Slicer A calculation group is working fine.
Slicer B calculation group is not working because I do not know how to implement a calculation group to interact on select measures.
My question: Is Approach 2 better than Approach 1? If yes, can someone point me in the right direction? I am just using DAX function PARALLELPERIOD in getting the Month over Month and Year over Year values in Slicer B.
Note 2: Sorry could not provide pbix since report is inside CITRIX env.
Many thanks,
- ja1meee
Solved! Go to Solution.
I would go with Field Parameters and independent measures.
What is the business problem you are trying to solve?
Hi @lbendlin , the client wants to compare the values generated from Slicer A from Slicer B.
I was able to create a Calculation group with for Slicer A with the following measures:
//for Primary vs Month on Month calculations
var _last7DaysMoM = CALCULATE([Actual],DATEADD('dim_date'[date],-1,MONTH))
var _mtdMoM = CALCULATE([Actual], DATEADD('dim_date'[date],-1,MONTH))
var _lastMonthMoM = CALCULATE([Actual], PARALLELPERIOD('dim_date'[date],-1,MONTH))
var _ytdMoM = CALCULATE( [Actual], DATEADD('dim_date'[date],-1,MONTH))
//for Primary vs Year on Year calculations
var _last7DaysYoY = CALCULATE([Actual], DATEADD('dim_date'[date],-1,YEAR))
var _mtdYoY = CALCULATE( [Actual ],DATEADD('dim_date'[date],-1,YEAR))
var _lastMonthYoY = CALCULATE( [Actual],PARALLELPERIOD('dim_date'[date],-1,YEAR))
var _ytdYoY = CALCULATE([Actual], DATEADD('dim_date'[date],-1,YEAR))
My follow up question is, should I adjust the calculation I have in Slicer A for the MTD and Last Month? or should I change the DATEADD dax function I used for the Slicer B?
I would go with Field Parameters and independent measures.
Thank you! This works for my report.