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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors