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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ignaciokairuz
Helper I
Helper I

Simple SLICER for SUM OF REVENUE in hierarchy

Hello Folks!

 

I tried hard to find a solution but i only got to find a couple of PBI visuals that didn't work.  I'm working with a matrix with 3 levels of hierarchy : Category , Brand , Model .

 

The problem is that if I insert a slicer and for the "Values Field" I choose " Σ REVENUE ", when I play with this slicer by changing the numbers of the range, the only hierarchy that this filter is applying to is the Models ( the third one ) . I can't , for example, find all the Brands that made over a certain number, it only works with the model of the products. 

 

You may be asking ,  What do you want this for?      ↓ ↓ ↓

 

I have a measure that shows a value that represent the ratio between the units sold and the amount of listings that are available of a certain model, thus , brand too. I would like to order the matrix by this field but filtering only the brands that made over a certain amount of revenue that I decide.

 

Thank you so much for your time to read this!

 

Have a nice one 🙂

 

Ignacio

1 ACCEPTED SOLUTION

Yes, I see what you mean. Ok, see of this works as a measure for the matrix:

 

Prices within range =
VAR _MinSel =
    MIN ( 'Price Range'[Price Range] )
VAR _MAxSel =
    MAX ( 'Price Range'[Price Range] )
VAR _Category =
    IF (
        OR ( ISINSCOPE ( 'Models'[MODEL] ), ISINSCOPE ( Brands[BRAND] ) ),
        BLANK (),
        CALCULATE ( [Sum Price], ALLEXCEPT ( 'Table', 'Table'[Category] ) )
    )
VAR _Brand =
    IF (
        OR ( ISINSCOPE ( 'Models'[MODEL] ), ISINSCOPE ( Categories[Category] ) ),
        BLANK (),
        CALCULATE (
            [Sum Price],
            ALLEXCEPT ( 'Table', Categories[Category], 'Brands'[Brand] )
        )
    )
RETURN
    SWITCH (
        TRUE (),
        AND ( [Sum Price] >= _MinSel, [Sum Price] <= _MAxSel ), [Sum Price],
        AND ( _Brand >= _MinSel, _Brand <= _MAxSel ), _Brand,
        AND ( _Category >= _MinSel, _Category <= _MAxSel ), _Category
    )

 

FSR1.gif

 

I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

13 REPLIES 13
PaulDBrown
Community Champion
Community Champion

Try this.

The equivalents would be:
Channel = Category
Item = Brand
Prod Ref = model

First, the model. I've created a table to use as the slicer for the sales value with the following:

 

Sales Range = GENERATESERIES(0, 3000, 100)

 

range table.jpg

model.jpg

Next create the measure to use as a filter in the filter pane for the matrix, setting the value to greater or equal to 1:

 

Filter Sales Range =
COUNTROWS (
    FILTER (
        VALUES ( 'DIM Item'[Item] ),
        [Sum of Sales] > SELECTEDVALUE ( 'Sales Range'[Sales Range] )
    )
)

 

filter.jpg

 

And you will get:

FSR.gif

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thanks @PaulDBrown ! It doesn't seem to work for me though...

GROWTH BETWEEN 2 MATRICES FROM DIFFERENT DATES - NOT FULL MATCHES.pbix

Here's what I've done. I asume [Sum of Sales] is just the Sum of the [PRICE] column

 

Thanks again in advance!

You must leave the price range table unrelated in the model, change the measure since you are using a range of prices, and use a simple SUM for price (the date filter will filter if needed)

I've attached your sample file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thanks @PaulDBrown ! I changed the "SELECTEDVALUE" for "MIN" too. Then only problem is that this filter only works with the "BRAND" hierarchy right? Do you think it's possible for it to work with all of them? Thanks anyway

In your example you have the row subtotals turned off, which I assume is because there's no point in summing prices (unless there is!) the range selector works over brands and model levels at least (I didn't check category levels), though the Brand Level is dependent on the selected Models. This is relevant: the measure filters out rows outside the range, so the Brand level will be the sum of the filtered Model level. 

 

You might try changing the filter expression to VALUES(Categories[Category]) if the selector does not affect the category level. If that doesn't work, we need a more specific measure using SWITCH





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






 @PaulDBrown even without the SWITCH function it's still not working. In the last file that you shared, for example, when filtering prices above 800, the matrix doesn't display the XIAOMI brand in the COMPUTERS category 😞

Yes, I see what you mean. Ok, see of this works as a measure for the matrix:

 

Prices within range =
VAR _MinSel =
    MIN ( 'Price Range'[Price Range] )
VAR _MAxSel =
    MAX ( 'Price Range'[Price Range] )
VAR _Category =
    IF (
        OR ( ISINSCOPE ( 'Models'[MODEL] ), ISINSCOPE ( Brands[BRAND] ) ),
        BLANK (),
        CALCULATE ( [Sum Price], ALLEXCEPT ( 'Table', 'Table'[Category] ) )
    )
VAR _Brand =
    IF (
        OR ( ISINSCOPE ( 'Models'[MODEL] ), ISINSCOPE ( Categories[Category] ) ),
        BLANK (),
        CALCULATE (
            [Sum Price],
            ALLEXCEPT ( 'Table', Categories[Category], 'Brands'[Brand] )
        )
    )
RETURN
    SWITCH (
        TRUE (),
        AND ( [Sum Price] >= _MinSel, [Sum Price] <= _MAxSel ), [Sum Price],
        AND ( _Brand >= _MinSel, _Brand <= _MAxSel ), _Brand,
        AND ( _Category >= _MinSel, _Category <= _MAxSel ), _Category
    )

 

FSR1.gif

 

I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown , It worked smoothly! I learned a lot! thank you so much  🙂

 

I only made a change for this to work perfectly and it's this :

 

VAR _Category =
    IF (
        OR ( ISINSCOPE ( 'Models'[MODEL] ), ISINSCOPE ( Brands[BRAND] ) ),
        BLANK (),
        [Sum Price])

Instead of the CALCULATE function I just used the SUM one because if not It returns the total sum of the matrix when the filter minimum is above the total value of a category.

 

Have a nice one!

See you around!

 

PaulDBrown
Community Champion
Community Champion

Can you please share sample data or non-confidential PBIX file?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thanks for answering @PaulDBrown ! 

Here's an example : 

GROWTH BETWEEN 2 MATRICES FROM DIFFERENT DATES - NOT FULL MATCHES.pbix 

The problem is right here : 

ignaciokairuz_0-1650895736594.png

The filter only works for the row level hierarchy. I can't filter by the subtotal for brands or categories...

 

Ignacio

ignaciokairuz
Helper I
Helper I

@amitchandak  , sorry to bother you but I know you're an expert in power bi and you help people ofter in this community. Would you mind if I ask your oppinion about this issue?

 

TheoC
Super User
Super User

Hi @ignaciokairuz 

 

Given the slicer is based on the amounts at the row level, if you are using a matrix that has three layers in the hiearchy, and you have them all expanded, you will get the revenue at the expanded level (i.e. Model).  If you collapse the matrix to Level 2, you should be able to use the slicer at the Brand level, and so on.

 

There are ways around this but just wanted to share my thoughts on what may be causing this to occur and then, if you still want a fix, we can certainly get something!

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thanks @TheoC ! As it didn't work for me I thought this was the way it worked by default in PBI ( the way is currently working for me ).  I checked and this is my current configuration of the slicer 

ignaciokairuz_0-1644970651281.png

 

It's in spanish but get the gist of it . "FACTURACION" = Revenue , "Categoría L1" = Category L1 , "Marca" = Brand , "Modelo" = Model.

 

Last time I checked the only field that had the filters settings with "allow drill through when : Summarized" was the last level , Model. Now I changed that but it's still not working fine. 

If you have an idea of what could be causing this problem I would be really grateful! 

 

Ignacio

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.