Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
My daily target turnover is $270000. I have a slicer for the year. The data is from 01/01/2023. I want when only the year 2023 is slected in the slicer the maximum value should come as 365 * 270000 if only 2024 is selected from the slicer then the maximum value should come 365 * 270000 if both the years are selected then 730 * 270000 and so on. If in case nothing is selected in the slicer then it should calculate (Today() - date(2023,1,1)) * 270000
Can somebody please help me to achieve this
Solved! Go to Solution.
Hi @euro_sree ,
To achieve your requirement, you can create a DAX measure that dynamically calculates the maximum value based on the selected year(s) in the slicer. Here’s how to do it:
Assume You Have a Date Table:
Create the Measure:
Maximum Target Turnover = VAR SelectedYears = VALUES(DateTable[Year]) -- Get the selected years VAR TotalDays = IF( ISFILTERED(DateTable[Year]), SUMX(SelectedYears, 365), -- Calculate total days for selected years TODAY() - DATE(2023, 1, 1) -- Days from 01/01/2023 to today ) RETURN TotalDays * 270000
Explanation:
Add the Measure to Your Visual:
Test the Functionality:
This measure is dynamic and should meet your requirement for handling both slicer selections and the default case when nothing is selected. Let me know if you need further adjustments! 😊
Please mark this as solution if it helps. Appreciate Kudos.
Hi @euro_sree ,
The method FarhanJeelani provided should be helpful.
Besides, you can also try the following DAX formula to calculate the max value based on slicer.
Maximum Target Turnover =
VAR SelectedYears = VALUES('Table'[Year])
VAR StartDate = DATE(2023, 1, 1)
VAR TodayDate = TODAY()
RETURN
IF (
ISFILTERED('Table'[Year]),
CALCULATE(COUNTROWS('Table') * 270000),
DATEDIFF(StartDate, TodayDate, DAY) * 270000
)
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @euro_sree ,
The method FarhanJeelani provided should be helpful.
Besides, you can also try the following DAX formula to calculate the max value based on slicer.
Maximum Target Turnover =
VAR SelectedYears = VALUES('Table'[Year])
VAR StartDate = DATE(2023, 1, 1)
VAR TodayDate = TODAY()
RETURN
IF (
ISFILTERED('Table'[Year]),
CALCULATE(COUNTROWS('Table') * 270000),
DATEDIFF(StartDate, TodayDate, DAY) * 270000
)
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @euro_sree ,
To achieve your requirement, you can create a DAX measure that dynamically calculates the maximum value based on the selected year(s) in the slicer. Here’s how to do it:
Assume You Have a Date Table:
Create the Measure:
Maximum Target Turnover = VAR SelectedYears = VALUES(DateTable[Year]) -- Get the selected years VAR TotalDays = IF( ISFILTERED(DateTable[Year]), SUMX(SelectedYears, 365), -- Calculate total days for selected years TODAY() - DATE(2023, 1, 1) -- Days from 01/01/2023 to today ) RETURN TotalDays * 270000
Explanation:
Add the Measure to Your Visual:
Test the Functionality:
This measure is dynamic and should meet your requirement for handling both slicer selections and the default case when nothing is selected. Let me know if you need further adjustments! 😊
Please mark this as solution if it helps. Appreciate Kudos.
Hi Farhan
Thank you so much for the solution and appreciate the way its been explained.
I will try this today and update you.
Regards
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 |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |