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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
In power BI I have a universal date table i am using for all queries. Its in DateTable[Date]. The date is a daily date but spans many years so if its kept at Day, it can be overly detailed. Therefore, For my line chart, i want to add a slicer where users can choose at what hierachy level they view the chart, i.e. if they want to view it in months, or in years or months, or days etc.
@MJ77 , You need a measure that dynamically adjusts based on the selected hierarchy level.
SelectedDateLevel =
SWITCH(
TRUE(),
ISFILTERED(DateTable[Year]) && NOT ISFILTERED(DateTable[Month]), "Year",
ISFILTERED(DateTable[Month]) && NOT ISFILTERED(DateTable[Day]), "Month",
ISFILTERED(DateTable[Day]), "Day",
"None"
)
Then create a measure that adjusts the aggregation based on the selected date level
DynamicMeasure =
SWITCH(
[SelectedDateLevel],
"Year", CALCULATE(SUM(Sales[Amount]), ALLEXCEPT(DateTable, DateTable[Year])),
"Month", CALCULATE(SUM(Sales[Amount]), ALLEXCEPT(DateTable, DateTable[Year], DateTable[Month])),
"Day", CALCULATE(SUM(Sales[Amount]), ALLEXCEPT(DateTable, DateTable[Year], DateTable[Month], DateTable[Day])),
SUM(Sales[Amount])
)
Use this dynamic measure in Y-axis
Proud to be a Super User! |
|
Thank you however. i want a slicer to be available to users of the report to also select the hierachy level a which they want to view th report