The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.