Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Good Day
I have been struggling for weeks now. I need help please on using dax, I have 4 measures one for each quarter in the year. I am struggling to figure out how can One use the a certian measure based on the selected date range. eg: If user selects 01 Jan 2023-15 Jan 2023 measure 1 should apply for that period or the user selects 01 April 2023 - 15 April 2023 measure 2 should apply.
I would really appreciate the assistance.
Regards,
Itu
Good Day tt_and
Thank you for assisting. Kindly note that the switch formula doesn't return the calandar table, screen dump below to show what I am getting.
Hi. I assume you have a date table that's used for slicing on dates. If you add a column to the date table defining each period on each date row, you can use this with a switch in a base measure.
Base measure =
switch(
calendar[Period],
1, [Measure1],
2, [Measure2],
3, [Measure3],
4, [Measure4]
)
Building on the approach proposed by @tt_and, you can also create a measure. The trick is to utilize a vartual table within the measure to generate the total of all the different measures you are switching between.
Base measure =
VAR __table1 =
ADDCOLUMNS (
calendar,
"@composite_measure",
SWITCH (
calendar[Period],
1, [Measure1],
2, [Measure2],
3, [Measure3],
4, [Measure4]
)
)
RETURN
SUMX ( __table1, [@composite_measure] )
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
9 |