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
rcyber
Resolver I
Resolver I

Dynamic rank issue

Hi all!

I'm trying to create the Pareto chart based on multiple slicers.

I have two columns for slicing. They are named "Area" and "Exp Category". And I have the "USD" column. It contains amounts I want to calculate and show in my Pareto chart.

 

It works fine for slicing by Area field if I use this formula to calculate Rank of Amounts:

 

Rank CC Area = RANKX(ALLSELECTED(Data[Area]); 
		CALCULATE(SUM(Data[USD]);
		ALLEXCEPT(Data; Data[Area])))

 

 

2018-03-19_10-30-32.png

 

 

But I want to add the second slicer by "Exp Category".

I added slicer by "Exp Category" field and then I added the "Exp Category" field to ALLEXCEPT section of formula:

 

 

Rank CC Area = RANKX(ALLSELECTED(Data[Area]); 
		CALCULATE(SUM(Data[USD]);
		ALLEXCEPT(Data; Data[Area]; Data[Exp Category])))

But it calculates strange values:2018-03-19_10-35-02.png

 

 

I guess it happens because I should replace ALLSELECTED(Data[Area]) with something. It must be anything like ALLSELECTED(ALLEXCEPT(Data[Area]; Data[Area]; Data[Exp Category])). But it does not work.

My pbix file is here.

I'll be grateful for any help.

 

Thanks in advance,

Alexander.

 

 

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

Hi @rcyber

 

Try adjusting the Rank formula as follows

 

Rank CC Area =
RANKX (
    SUMMARIZE ( ALLSELECTED ( Data ), Data[Area], Data[Exp Category] ),
    CALCULATE (
        SUM ( Data[USD] ),
        ALLEXCEPT ( Data, Data[Area], Data[Exp Category] )
    )
)

Regards
Zubair

Please try my custom visuals

@rcyber

 

And Cumulative Area as follows

 

Cumulative Area Total =
VAR rr = [Rank CC Area]
RETURN
    (
        CALCULATE (
            SUM ( Data[USD] ),
            FILTER (
                SUMMARIZE ( ALLSELECTED ( data ), Data[Area], Data[Exp Category] ),
                [Rank CC Area] <= rr
            )
        )
    )

Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad,

Thanks a lot for quick help.

It works good and calculates rank correctly.

 

But it's not exactly what I want co create.

The SUMMARIZE function calculates subtotals with filtering by Data[Area] and Data[Exp Categories] fields.

But I want to calculate (and rank next) subtotals grouping by Data[Area] and filtering Data[Area] and Data[Exp Categories] both.

I want to create the report like this:2018-03-20_14-35-50.png

 

 

 

I hope you understand what I mean.

 

Thanks in advance,

Alexander.

Hi @rcyber

 

I will look into it and get back to you


Regards
Zubair

Please try my custom visuals

 

Do you have any ideas about my question?

Best regards,
Alexander.

 

Hi @rcyber

 

My apologies for late reply...

 

Please try this revised MEASURE.

 

File attached here as well

 

Rank CC Area =
RANKX (
    ALLSELECTED ( Data[Area] ),
    CALCULATE ( SUM ( Data[USD] ) ),
    ,
    DESC,
    DENSE
)

 

Cumulative Area Total =
VAR rr = [Rank CC Area]
RETURN
    (
        CALCULATE (
            SUM ( Data[USD] ),
            FILTER ( ALLSELECTED ( Data[Area] ), [Rank CC Area] <= rr )
        )
    )

 


Regards
Zubair

Please try my custom visuals

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.