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.
I have a single table source. This table has a Date attribute. This Date spans a 6-month range. I have created a derived column in my PBI data model to identify if the given date is in the first half of the time range or the second half of the time range (i.e., 'first 3 months', 'last 3 months'). The user is now asking for the ability to select the entire time range vs just the first 3 months, as a slicer with single-select (so, something like 'first 3 months', 'all 6 months'). How can I achieve this?
Hi @Anonymous,
Without a sample data, I can only imagine how it looks.
There are many ways to achieve your requirement and this just one.
Rolling Month Number =
DATEDIFF (
CALCULATE ( MIN ( 'Table'[Date] ), ALL ( 'Table' ) ),
'Table'[Date],
MONTH
) + 1
Range =
DATATABLE (
"Range", STRING,
"MaxMonth", INTEGER,
{
{ "first 3 months", 3 },
{ "all six months", 6 }
}
)
Use this measure to as a visual filter. From the filters pane, select is not blank.
RowCount =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[Rolling Month Number] <= MAX ( Range[MaxMonth] ) )
)
Proud to be a Super User!
It would be helpful if you could provide sample pbix file.
@AnonymousHow can I post a sample pbix file? I don't see an option in this forum to attach files.
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |