The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Is something like this possible? I'm trying to create a matrix that has about twenty measures on rows and three date columns that change dynamically based on two slicers (month/year "From" and "To").
The first column needs be the month selected in the "To" slicer. The second column to be the range between "From" and "To". The third column to be the previous year range. Crude mock up of what I am trying to accomplish below...
Slicers:
FROM: | October 2023 | TO: | July 2024 |
Matrix:
Jul-24 | Oct 23 - Jul 24 | Oct 22 - Jul 23 | |
Hours | 100 | 950 | 1,100 |
Billings | 80,000 | 640,000 | 780,000 |
Write Offs | 2,000 | 30,000 | 25,000 |
Collections | 75,000 | 500,000 | 675,000 |
I currently have one fact table with all the measures and one date table.
I'm really stuggling to understand how I would even go about this. I have the matrix with all my measures on rows created, but I can't seem to make the columns work the way I want.
@cgm , You need two disconnected Date tables for slicer, and then you need measure like
Date Range Using 2 slicer =
var _max = minx(allselected(Date1), Date1[Date])
var _min = maxx(allselected(Date2), Date2[Date])
var _Lmax = eomonth(_max,-12)
var _Lmin = eomonth(_Min,-12)+1
return
calculate(countrows(Table), Filter(Table,(Table[Date] <=_max && Table[Date] >=_min) || (Table[Date] <=_Lmax && Table[Date] >=_Lmin)) )
This will give both selected range and last year same range
Now instead of creating all the measures use calculation groups and have item like
Date Range Using 2 slicer =
var _max = minx(allselected(Date1), Date1[Date])
var _min = maxx(allselected(Date2), Date2[Date])
var _Lmax = eomonth(_max,-12)
var _Lmin = eomonth(_Min,-12)+1
return
calculate(selectedmeasure(), Filter(Table,(Table[Date] <=_max && Table[Date] >=_min) || (Table[Date] <=_Lmax && Table[Date] >=_Lmin)) )
You also need consider Matrix Visual Property switch value to rows
Abstract Thesis: How to use two Date/Period slicers
calculation group authoring| Measure Slicer: https://youtu.be/VfxfJJ0RzvU
Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0
Thank you for the response amitchandak. I am having trouble with getting the date range to work based on month/year. (its also not working if I just use date). Can you tell what I am doing wrong from the screenshots below?
Two date tables and a fact table:
Date Range Using two slicers:
If I select the same month in each slicer, the correct data appears (left slicer is from Dim_TIme, right is from Dim_Time2):
No Data is returned when the same month is not selected in both slicers:
User | Count |
---|---|
65 | |
62 | |
60 | |
53 | |
30 |
User | Count |
---|---|
181 | |
83 | |
68 | |
49 | |
46 |