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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
thameem10
Frequent Visitor

Dynamic Column calculation based on Slicer Selection

I have 3 Tables "Variables", "Sales Data" and "Scrap Ratio".

 

The Variable Table holds the year from 2009 to 2025. Scrap Ratio has the Age Number wise Category description and Scrappage rate and sales data has the following data points (sample data below with excel formulas and pivot).

 

Sold MonthBusiness DivisionSales GroupModel GroupCountAgeAge BucketRemain RateActive Units
2009TruckRetailMDL180399>1000
2010TruckRetailMDL175299>1000
2011TruckRetailMDL173599>1000
2012TruckRetailMDL194999>1000
2013TruckRetailMDL1168099>1000
2014TruckRetailMDL1168510N-90.6611114
2015TruckRetailMDL127959N-80.6831909
2016TruckRetailMDL122218N-70.7191597
2017TruckRetailMDL120857N-60.761585
2018TruckRetailMDL118506N-50.8031486
2019TruckRetailMDL110595N-40.852902
2020TruckRetailMDL18144N-30.907738
2021TruckRetailMDL18233N-20.96790
2022TruckRetailMDL117682N-10.9851741
2023TruckRetailMDL113981N0.9851377
2024TruckRetailMDL124290CY12429

 

Excel Formulas :

Age: =IF(Variables!$B$1-'NV Data'!$A2>10,99,Variables!$B$1-'NV Data'!A2)

Age Bucket =IFERROR(XLOOKUP(F2,'Scrap Ratio'!A:A,'Scrap Ratio'!B:B),">10")

Remaining Rate =IFERROR(XLOOKUP(F2,'Scrap Ratio'!A:A,'Scrap Ratio'!C:C),0)

 

The Age column in the "Sales Data" table should reflect the Age difference between the Selected / Filtered year and Sold Month. This should dynamically change upon using the slicer and the overall Pivot / Power BI Matrix should change accordingly.

 

Scrap Ratio Table

Age NoAge NRemain Rate
0CY1
1N0.985
2N-10.985
3N-20.96
4N-30.907
5N-40.852
6N-50.803
7N-60.76
8N-70.719
9N-80.683
10N-90.661

 

I want to replicate this excersise in Power BI, where the Power BI Matrix has to reflect the pivot structure for the selected / filtered year in the Slicer (Table - Variable).

 

In this case 2023 is selected in the Slicer, basis which "Age" column calculated and then the this pivot got refreshed.

thameem10_0-1739793720798.png

 

I would apriciate your support in resolving this one.

 

@amitchandak @Ashish_Mathur 

2 ACCEPTED SOLUTIONS

Hi,

PBI file attached.

Ashish_Mathur_0-1740011357944.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi Ashish, Thanks a lot for solving this in Power BI. I apriciate your expertise in this space.

View solution in original post

5 REPLIES 5
thameem10
Frequent Visitor

Hi Ashish, Thanks for your reply. Please have this file link for your understanding of the formulaes.

Active Units by Selected Year.xlsx

 

The Idea is to see the pivot data Active Units basis the selected year.

Hi,

PBI file attached.

Ashish_Mathur_0-1740011357944.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, Thanks a lot for solving this in Power BI. I apriciate your expertise in this space.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Not sure how much i can help but i would like to try.  Share the download link of the MS Excel file with your formulas/Pivot Tables already there.  It will be easier to understand your logic from there and convert it into measures.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.