Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Arti12
Frequent Visitor

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.

 

1.png

1 ACCEPTED SOLUTION
amitchandak
Super User
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.

View solution in original post

4 REPLIES 4
amitchandak
Super User
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.

Dear @amitchandak,

Thanks for answer. Unfortunately I can't send the source but let me be more specific.

 

Arti12_0-1636100181236.png

 

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

 

 

 

 

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Arti12
Frequent Visitor

Anyone? 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.