cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Diegomon
Frequent Visitor

Ranking categories but ignoring subcategory

Hello community,

 

I am having a problem trying to achieve the following ranking (based on Value column) by using DAX, is there any solution for it?

 

Diegomon_0-1656561643580.png

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Diegomon ,

 

The formula can be modified to retain the date filter conditions corresponding to the external filter context.

Try like  below:

M_ = 
CALCULATE (
    SUM ( FactInternetSales[SalesAmount] ),
    ALLEXCEPT (
        DimProductSubcategory,
        DimProductCategory[EnglishProductCategoryName]
    ),
    ALLEXCEPT ( DimDate, DimDate[FiscalYear] )
)

vhenrykmstf_0-1657097414488.png


If the problem is still not resolved, please provide detailed error information and text data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Diegomon ,

 

The formula can be modified to retain the date filter conditions corresponding to the external filter context.

Try like  below:

M_ = 
CALCULATE (
    SUM ( FactInternetSales[SalesAmount] ),
    ALLEXCEPT (
        DimProductSubcategory,
        DimProductCategory[EnglishProductCategoryName]
    ),
    ALLEXCEPT ( DimDate, DimDate[FiscalYear] )
)

vhenrykmstf_0-1657097414488.png


If the problem is still not resolved, please provide detailed error information and text data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jos_Woolley
Solution Sage
Solution Sage

Hi,

MyRank =
RANKX(
    ALLSELECTED( 'Table' ),
    CALCULATE( SUM( 'Table'[Value] ), ALLEXCEPT( 'Table', 'Table'[Category] ) ),
    ,
    ,
    DENSE
)

Regards

That's working thank you, but what happens when there are slicers filtering the data? Let's say that the table contains information about 2 years and I use the slicer to filter the information for 1 year, how can I handle that? "ALLEXCEPT" function is affecting these filters

 

For example, "Hospitality" should be number 1 because of year filter

Diegomon_0-1656566131628.png

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors