Forum Discussion
Substract column - measure
Hi Guys,
I have 42 weeks with data in the matrix table. When choosing from the filter (2 weeks), I would like to be able to subtract the values from each other. But I would like to be able to subtract values from different weeks (depending on which I choose from the filter) - e.g. week 4 - week 5. But it could also be week 40 - week 32.
How can I make such a column at the end?
The problem is also that I can't add any new columns to the model, I have to rely on measures.
Please find the screen below.
Arti12 , A measure like
sales =
var _max = maxx(allselected('Date'),'Date'[Week])
var _min = minx(allselected('Date'),'Date'[Week])return
calculate([Measure], filter('Date', 'Date'[Week] =_max)) - calculate([Measure], filter('Date', 'Date'[Week] =_min))or
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
4 Replies
- amitchandak
Super User
Arti12 , A measure like
sales =
var _max = maxx(allselected('Date'),'Date'[Week])
var _min = minx(allselected('Date'),'Date'[Week])return
calculate([Measure], filter('Date', 'Date'[Week] =_max)) - calculate([Measure], filter('Date', 'Date'[Week] =_min))or
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- Arti12Frequent Visitor
Dear amitchandak,
Thanks for answer. Unfortunately I can't send the source but let me be more specific.
The problem is that I cannot insert any column in the model, only measures. I would like to have only one value in the end - the result of substraction.
Is it possible to implement?
I've tried your measure but it didn't work.
BR,
Artur
- AnonymousNot applicable
Hi Arti12,
Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
- Arti12Frequent Visitor
Anyone? 🙂