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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ecarg_124
Helper I
Helper I

Using ALL function with a Filter

Hi All,

 

I'm trying to create a DAX formula in order to get the total sales of each segment for each region (Sales (Total Region/Segment)) column. I was able to do this successfully using the ALL function (see first table). However, my dilemma is that i will need to drill down my data differently.

 

Table 1.JPG

 

Instead of doing Region >> Segment >> Sku, I need to drill down based on Region >> Grouping (which is a column I added to combine segment & package) >> Sku. However, the total sales that I need is still the same as above where I need the total sales for each segment for each region. See below sample desired output. I tried using the ALL function and i was able to get only the sum of the regions, but i will still need to filter it by segment without adding the SEGMENT in the row. Is this possible?

 

Desired Output.JPG

 

I have attached a link to the .pbix file. 

Sample .pbix file

 

Thank you so much in advance for your help!

 

4 REPLIES 4
amitchandak
Super User
Super User

@ecarg_124 ,

Try all except

calculate([sales],allexpecpt(Table,table[region], table[segment]))

 

https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

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

 

Thank you so much for the quick response! I tried this formula below.

Capture.JPG

 

but the results are still not what i'm looking for. This gives me total Region only, but what i would like to see is the total segment by region. My data set is under the SALES DATA table, but i have look-up tables for Regions and products that are separate. How should i modify your recommendation below? 

 

Capture2.JPG

 

Thank you again!

Hi  @ecarg_124 ,

 

Yes,as suggested by @amitchandak ,you need first separate the columns for segments out,then you can make further calculation.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

@ecarg_124 , do you Really have values like  Segment 1, Segmeant 2 or they are always concatenated with Package. If so, first separate out that.

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

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.