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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have a table visual based on Month and Cost and it has a Month slicer as shown below:
I want to calculate cost movement but the ask is that when the relative slicer is set then the minimum date should have a base cost of £1.27 of Month 2021-01. This base cost is use to divide all other month to Maximum month of 2021-08.
For example, the movement from 2021-01 to 2021-02 is £1.25 divided by £1.27 = 99% and another example is movement from 2021-01 to 2021-02 will be £1.25 divided by £1.27 = 99% and for movement 2021-01 to 2021-03 is £1.27 divided by £1.27 = 100% and so on till movement from 2021-01 to 2021-08 will be £1.26 divided by £1.27 = 99.2%. How can I calculate this logic in Power BI (dax).
Solved! Go to Solution.
You can try something like this:
Movement =
-- Get min date in context
VAR _minDate = CALCULATE(MIN('Table'[Date]), ALLSELECTED('Table'[Date]))
-- Get current date value in context
VAR _maxDate = MAX('Table'[Date])
-- Calculate for min date value
VAR _minVal = CALCULATE(SUM('Table'[Cost]), 'Table'[Date] = _minDate)
-- Calculate for values within range.
VAR _currVal = CALCULATE(SUM('Table'[Cost]), KEEPFILTERS('Table'[Date] >= _minDate && 'Table'[Date] <= _maxDate))
RETURN
-- Divide current value against minumum value for movement percentage.
DIVIDE(_currVal, _minVal)
Hi,
Share the link from where i can download your PBI file.
You can try something like this:
Movement =
-- Get min date in context
VAR _minDate = CALCULATE(MIN('Table'[Date]), ALLSELECTED('Table'[Date]))
-- Get current date value in context
VAR _maxDate = MAX('Table'[Date])
-- Calculate for min date value
VAR _minVal = CALCULATE(SUM('Table'[Cost]), 'Table'[Date] = _minDate)
-- Calculate for values within range.
VAR _currVal = CALCULATE(SUM('Table'[Cost]), KEEPFILTERS('Table'[Date] >= _minDate && 'Table'[Date] <= _maxDate))
RETURN
-- Divide current value against minumum value for movement percentage.
DIVIDE(_currVal, _minVal)
Thanks @hnguy71 it worked perfectly. Your dax is on point👏
Please, I posted a problem a week ago, it involves dax. The link below:
Hey @Anonymous ,
The answer to that is similar to this.
1. Break your relationship between relative period and the date table.
2. Harvest the minimum relative date and the maximum relative date.
3. Generate your new min and max dates
4. Count the values between those dates similar to your "movement".
To understand this logic, I have the screenshot below in excel. Movement is calculate by Column E .
Hence, when i select my relative month Slicer from 2021-01 to 2021-08 then minimum cost base from month 2021-01is 1.27 that is used to divide other months to get movement in % or decimals.
Hope it make sense.
I am unable to understand the requirement. If you can exolain a bit in detail and maybe an example in excel with what the cost movement column might look like.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.