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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
aktripathi2506
Helper IV
Helper IV

Subtracting a cell value from a another cell (measure) in a single column

HI,

 

I have the following scenario:

In the visual I am summarising the weekly data.

So I have week then next column I have is hours, which is basically the sum of hours for the week.

I have a measure which has certain value.

Now I want the third column having ongoing subtraction:

 

If the value of measure is 3200 then value of column 'new' should be as follows:

 

WeekHoursNew
1253175
2483127
33862741
43742367
56881679
63521327
7534793
8365428
9164264
10295-31

 

Thanks & Regards,

A

2 ACCEPTED SOLUTIONS
jahida
Impactful Individual
Impactful Individual

New version of the formula:

 

Measure = 500 - MINX(test, SUMX(FILTER(ALL(test), test[Week] <= EARLIER(test[Week]) && test[Week] > 0 && test[Report Week] = EARLIER(test[Report Week])), test[Hours]))

View solution in original post

After seeing his data; the key is that have weeks with negatives values, so the measure was modified to:

 

MeasureToSubstractions = [Measure]-CALCULATE(Sum(test[Hours]);FILTER(ALLEXCEPT(test;Test[Year];test[Report Week]);test2[Week]<=max(test[Week]) && test[Week]>0))




Lima - Peru

View solution in original post

25 REPLIES 25

Can you share us the pbix file; deleting all the data that you considered critical to show. I think this will be the  easy way to help you in more reduced time.

 

 




Lima - Peru

After seeing his data; the key is that have weeks with negatives values, so the measure was modified to:

 

MeasureToSubstractions = [Measure]-CALCULATE(Sum(test[Hours]);FILTER(ALLEXCEPT(test;Test[Year];test[Report Week]);test2[Week]<=max(test[Week]) && test[Week]>0))




Lima - Peru

Thank you so much guys. Both of you @Vvelarde and @jahida for your sincere efforts and time.

Thanks a lot. It worked now, finally :))

 

MeasureValues = [Measure]-CALCULATE(Sum(WeekReport[hours]);FILTER(ALLEXCEPT(WeekReport;WeekReport[Reporting Week]);WeekReport[week]<=max(WeekReport[week])))



Lima - Peru

Hi @aktripathi2506

 

Values = [Measure]-CALCULATE(Sum(WeekReport[hours]);FILTER(ALLEXCEPT(WeekReport;WeekReport[Reporting Week]);WeekReport[week]<=max(WeekReport[week])))



Lima - Peru

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors