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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
powerbi0718
Microsoft Employee
Microsoft Employee

Dynamic calculation based on slicer selection to compare two months values

Hi,

 

I have been trying to work on this for quite some time but not able to find the solution:
I have a table like this in which there could be a change in state of the program every month. what i need is an additional column that could show the value based on the slicer selection.


Month YearProgramState
1/1/2023ABC01Charter
1/1/2023ABC02Charter
1/1/2023ABC03Closure
1/1/2023ABC04Cancelled
2/1/2023ABC01Charter
2/1/2023ABC02Charter
2/1/2023ABC03Closure
2/1/2023ABC04Cancelled
2/1/2023ABC05Approved
3/1/2023ABC01Charter
3/1/2023ABC02Charter
3/1/2023ABC03Closure
3/1/2023ABC04Cancelled
3/1/2023ABC05Approved
3/1/2023ABC06Charter
3/1/2023ABC07Approved



For example slicer selection is Jan 2023 and March 2023. My output should look like this :


Month YearProgramStatePrevMonthState
1/1/2023ABC01Charter 
1/1/2023ABC02Charter 
1/1/2023ABC03Closure 
1/1/2023ABC04Cancelled 
3/1/2023ABC01CharterCharter
3/1/2023ABC02CharterCharter
3/1/2023ABC03ClosureClosure
3/1/2023ABC04CancelledCancelled
3/1/2023ABC05Approved 
3/1/2023ABC06Charter 
3/1/2023ABC07Approved 

 

5 REPLIES 5
amitchandak
Super User
Super User

@powerbi0718 , you can use a date table joined with the date of your table and time intelligence

 

calculate(max(Table[Status]), previousmonth(Date[date]))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I dont' need your comment.

Obviously, your formula is error-prone; if any other columns exists in the viz, it's damaged; ALLEXCEPT() is necessary.

Anyway, talk to the thread initiator.

 



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



@ThxAlot , Sorry about mentioning your name, when I initially typed the name I got confused because it showed two names and one blank update below. So I thought you were the tread owner. 

I corrected the name just a couple of minutes back.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
ThxAlot
Super User
Super User

.



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



its not always going to be previous month. depending upon what user is selecting it could be Jan 2023 and April 2023 or Jan 2023 and Feb 2023 or Feb 2023 and Aug 2023

@ThxAlot 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors