March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Dear all,
I am trying to calculate an index value for time series data which should be used as a basis for % change calculations.
Desired outcome:
Sales month | Pct % | index basis | calculated value | |||
01.01.2019 | 43,1 | 43,1 | 43,1/43,1 | |||
01.02.2019 | 38,5 | 43,1 | 38,5/43,1 | |||
01.03.2019 | 35,7 | 43,1 | 35,7/43,1 | |||
... |
The index basis should be calculated automatically based on the slicer selection (supplier, category levels 0-2, product number).
All data is stored in one table.
I created two measures until now:
Sales month | Pct % | index basis | minDate | |||
01.01.2019 | 43,1 | 43,1 | 01.01.2019 | |||
01.02.2019 | 38,5 | 38,5 | 01.01.2019 | |||
01.03.2019 | 35,7 | 35,7 | 01.01.2019 | |||
... |
If I use a specific date (e.g. 01.01.2019) instead of minDate as filter the result looks like this:
Sales month | Pct % | index basis | minDate | |||
01.01.2019 | 43,1 | 43,1 | 01.01.2019 | |||
01.02.2019 | 38,5 | 01.01.2019 | ||||
01.03.2019 | 35,7 | 01.01.2019 | ||||
... |
Then, the calculation (pct % / index basis) would result in infinity for 02 and 03/2019.
Do you have an idea how to resolve the problem with measures or in any other way (indexate month % to first value)?
Thank you very much in advance!
Solved! Go to Solution.
As long as the filter on mindate works i dont believe you need to combine the two, if theres more than 1 value per date in [Ptr %] i believe that all we need to do is change it to AVERAGE().
Measure =
VAR minDate = [minDate]
Return
CALCULATE(AVERAGE(Table[Pct %]) ; ALL(Datatable) ; Datatable[Sales Month] = minDate)
Br,
J
are you able to provide the data or a pbix?
Proud to be a Super User!
Unfortunately I can't upload files here but I uploaded a sample data set to Wetransfer - hope this works!
hi got the file the problem is your date, your date looks like a lookup table value.
In order to identify the problem i need to replicate your pbix. If you can share the pbix that would be easier, if not please provide the dates.
Proud to be a Super User!
It seems like the upload on wetransfer changed the column formatting. The dates in the column are correct, just the excel format needs to be changed:
Unfortunately I can't share the PBIX file as it contains sensitive information, I'm sorry!
hi, so if i understand correctly what you trying to do is fill down the value when there isn't a valid value, i can't actually see a way to do it currently but ill keep digging and if anyone else wants to jump in thats great too
Proud to be a Super User!
Thank you very much! In fact I just want to always use the average for the first date as basis for the calculation. Unfortunately I could not find a way on how to filter the measure dynamically to the first date for the selected category/supplier/... for all rows 😞
The goal is to have a line chart where the line always starts at 100% and then the increases/decreases are displayed based on the first reference value.
Try this:
Measure =
VAR minDate = [minDate]
Return
CALCULATE(SELECTEDVALUE(Table[Pct %]) ; ALL(Datatable) ; Datatable[Sales Month] = minDate)
Br,
J
Thank you very much for your input! With this method the selection of the min date works fine. However, selectedvalue is returning blank (I assume because there can be multiple values per month which need to be averaged first). But I don't have an idea how to combine average with selectedvalue. Do you have an idea on that?
As long as the filter on mindate works i dont believe you need to combine the two, if theres more than 1 value per date in [Ptr %] i believe that all we need to do is change it to AVERAGE().
Measure =
VAR minDate = [minDate]
Return
CALCULATE(AVERAGE(Table[Pct %]) ; ALL(Datatable) ; Datatable[Sales Month] = minDate)
Br,
J
I came to the same insight just a few minutes ago 🙂 thank you very much for your support! Saved my day!
I just changed it a bit and removed the ALL clause so the solution looks like this now:
Get the first date:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
165 | |
116 | |
63 | |
57 | |
50 |