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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Bohumil_Uhrin
Helper II
Helper II

Measure to show also previous month using slicer

Hi,

Im trying to do the following:

I have visual with 2 measures:

Amortisation value actual month = calculate(sum(data[Amortization value]),filter(data,data[Month]=[max month]))
Amortisation value previous month = CALCULATE(sum(data[Amortization value]),All(data[Month]),filter(data,data[Month]=[max month]-1))
 
[max month] is defined as = max(data[Month])
 
pbi measure.PNG
 
The point is to use slicer to select actual month, and in the visual compare selected month with previous one.
Im using All() function to ignore slicer selection.
But somehow, the previous month measure returns blank values. Any idea why is that and how can I approach this?
Thank you in advance.
1 ACCEPTED SOLUTION

Hi @Bohumil_Uhrin ,

 

You can use the following measure, and it will show what you want:

Amortisation value prev = 
VAR prev_month = MAX(data[Month])-1
RETURN
calculate([Amortisation value],filter(ALLEXCEPT(data,data[Material]),data[Month]=prev_month))

 

Capture.PNG

If this post help, please consider accept it as the solution to help other member find it more quickly.

 

Best Regards,

Dedmon Dai

 

View solution in original post

6 REPLIES 6
lbendlin
Super User
Super User

is your data[Month]  a date field or a number field? what happens if the month is January?

Did you notice that you subtract 1 twice?

data[Month] is number field

yeah, I subtracted twice - I corrected

I have data only for months 3-9. When I select the smallest (3), its the same - blanks.

 

I shared file on onedrive: https://1drv.ms/u/s!AsS4aATA1W9agqQtzmF_2oMhuMB6aA?e=YmOQXZ

thank you very much for your help

Hi @Bohumil_Uhrin ,

 

You can use the following measure, and it will show what you want:

Amortisation value prev = 
VAR prev_month = MAX(data[Month])-1
RETURN
calculate([Amortisation value],filter(ALLEXCEPT(data,data[Material]),data[Month]=prev_month))

 

Capture.PNG

If this post help, please consider accept it as the solution to help other member find it more quickly.

 

Best Regards,

Dedmon Dai

 

thank you, this worked well 🙂

Bohumil_Uhrin
Helper II
Helper II

hi, yes, I was using measure for [max month], but with the variable its the same - Im geting blank values

 

Amortisation value prev =
VAR prev_month = MAX(data[Month])-1
RETURN
calculate(sum(data[Amortization value]),ALL(data[Month]),filter(data,data[Month]=prev_month-1))
lbendlin
Super User
Super User

is [max month]  a measure?  Use a variable instead.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.