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

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

Reply
Anonymous
Not applicable

How to create a calculated column based on filter selected

I am trying to create a calculated column based on filter selected

This is my base table:

yearmonthvaluelocation
2020(01) JAN2A
2020(02) FEB1B
2020(03) MAR5C
2020(04) APR5A
2020(05) MAY3A
2020(06) JUN5C
2020(07) JUL3B

 

I would like to create a matrix that likes this: create a calculated column "newest location" always show the location of the max month selected. i need this as a column not a measure buecasue i need to put this in a Matrix as 'Rows"

 

When month 1 & 2 is selected:

 newest location(01) JAN(02) FEB
valueB21

 

When month 1 & 2 &3 is selected:

 

 newest location(01) JAN(02) FEB(03) MAR
valueC215
1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

Calculated columns never change based on slicer and filter selections, so it must be created as a Measure unfortunately. If you need it on rows, you may need to get creative with how you display the values in the matrix. There is an option to show values on rows, but that affects all values. You could display two tables/matrices side by side. You could also go the really tedious route of creating a measure for each month, so that newest location and all the monthly aggregates can be placed in Values in the matrix.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You can not create a calculated column based on the slicer. The column is calculated and stored as physical data and static in nature.

You have think about that calculation like Measure

https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/

 

You can measure like SUMX , COuntX etc , Here you can have column calculation

 

example

new column = [Price]* [Qty]

 Sales measure = Sum([new column]

 

You can have measure like

New Sales  - Sumx(Table, [Price]* [Qty] )

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
AllisonKennedy
Super User
Super User

Calculated columns never change based on slicer and filter selections, so it must be created as a Measure unfortunately. If you need it on rows, you may need to get creative with how you display the values in the matrix. There is an option to show values on rows, but that affects all values. You could display two tables/matrices side by side. You could also go the really tedious route of creating a measure for each month, so that newest location and all the monthly aggregates can be placed in Values in the matrix.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.