Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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] ) )
)
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.
User | Count |
---|---|
98 | |
76 | |
75 | |
49 | |
27 |