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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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