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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
jcamilo1985
Helper III
Helper III

ignore filters but with valid row context

Good afternoon experts

 

I have the following data model, I need to perform a calculation in dax that allows me to bring the sales amount of the previous year to place it in a table, this calculation must ignore all user filters but must respect the filter context of the table is say show the amount for each row of the table "region", as you can see in the image I got a measure but ignore the context of the table row
Does anyone know how to achieve this effect

 

jcamilo1985_1-1600469162337.png

ventas año pasado =
var tot_ventas_full = SUMX(ALL(ventas),[ventas_pbs])
return
CALCULATE(tot_ventas_full,PARALLELPERIOD(calendario[keyDate],-1,YEAR))

 

jcamilo1985_2-1600469610598.png

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

You could either try using ALLEXCEPT or try putting specific tables in the ALL() to only ignore filters on some tables but not region.

Also, be careful with your SUMX function - you have put [Ventas_pbs] inside the SUMX and I'm guessing that [Ventas_pbs] is already a sum, so you're essentially asking Power BI to calculate a SUM of a SUM. This doesn't usually become apparent as an issue until you have unevenly spaced data, but it is NOT best practice to do a SUM inside a calculated column unless that is truly your intention (and I don't think it is in this case).

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

1 REPLY 1
AllisonKennedy
Super User
Super User

You could either try using ALLEXCEPT or try putting specific tables in the ALL() to only ignore filters on some tables but not region.

Also, be careful with your SUMX function - you have put [Ventas_pbs] inside the SUMX and I'm guessing that [Ventas_pbs] is already a sum, so you're essentially asking Power BI to calculate a SUM of a SUM. This doesn't usually become apparent as an issue until you have unevenly spaced data, but it is NOT best practice to do a SUM inside a calculated column unless that is truly your intention (and I don't think it is in this case).

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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