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
Stelian
Helper I
Helper I

FIltering but no quite filtering

Hello everybody,

I need to create a report in power bi and I have this table:

level 1level 2Amount
M1C110
M1C220
M1C330
M1M15

in level 1 a market, in level 2 companies contained in the level 1 market, column 3 values. I am using first 2 columns (level 1 and level 2) as distinct filters.

I need this:

- when I select level 1 M1 without selecting nothing on level 2 , I need to get level 2 M1 value - 5;

- after selecting level 1 M1, when I select level 2 C1 I need to have C1 value - 10,

- if I select C1 and C2 , I want to get value 30 (C1+C2).

 

Can you help me with this please?

 

1 ACCEPTED SOLUTION
punitkhatri
Helper III
Helper III

Hii @Stelian 

I made the following measure, and got the results that are there in the screenshots attached.
Please try it and let me know whether your problem is solved or not.
Measure Formula = 

Slicer =
VAR Markets =
    SELECTEDVALUE ( Marketcompany[Market] )
VAR Companies =
    SELECTEDVALUE ( Marketcompany[Company] )
VAR Amt =
    CALCULATE ( SUM ( Marketcompany[Amount] ), ALL ( Marketcompany[Market] ) )
VAR AmtMarket =
    CALCULATE ( SUM ( Marketcompany[Amount] ), Marketcompany[Company] = Markets )
RETURN
    SWITCH (
        TRUE (),
        AND (
            ISFILTERED ( 'Marketcompany'[Market] ),
            ISFILTERED ( Marketcompany[Company] )
        ), Amt,
        ISFILTERED ( Marketcompany[Market] ), AmtMarket,
        Amt
    )
s1.pngS2.png
 

View solution in original post

6 REPLIES 6
Stelian
Helper I
Helper I

Thank you.

Happy to help..!!

punitkhatri
Helper III
Helper III

Hii @Stelian 

I made the following measure, and got the results that are there in the screenshots attached.
Please try it and let me know whether your problem is solved or not.
Measure Formula = 

Slicer =
VAR Markets =
    SELECTEDVALUE ( Marketcompany[Market] )
VAR Companies =
    SELECTEDVALUE ( Marketcompany[Company] )
VAR Amt =
    CALCULATE ( SUM ( Marketcompany[Amount] ), ALL ( Marketcompany[Market] ) )
VAR AmtMarket =
    CALCULATE ( SUM ( Marketcompany[Amount] ), Marketcompany[Company] = Markets )
RETURN
    SWITCH (
        TRUE (),
        AND (
            ISFILTERED ( 'Marketcompany'[Market] ),
            ISFILTERED ( Marketcompany[Company] )
        ), Amt,
        ISFILTERED ( Marketcompany[Market] ), AmtMarket,
        Amt
    )
s1.pngS2.png
 

Thank you so much.

amitchandak
Super User
Super User

@Stelian , That should happen with 2 separate slicers. default power bi feature, can you share the issue screenshot

https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-slicers?tabs=powerbi-deskt...

The company structure:

marketcompany
M1C1
M1C2
M1C3
M1M1
M2C4
M2C5
M2C6
M2M2

 

The figures:

companyAmount
C110
C220
C330
M15
C423
C554
C665
M212

 

The filters:

market company
M1 C1
M2 C2
  C3
  M1
  C4
  C5
  C6
  M2

 

When I select only market M1 I need to get only M1 value from company level: 5.

When I select market market M1 and company C1, i need to get only C1 value 10.

When I select market market M1 and companies C1 and C2, i need to get C1+C2 value 30.

 

I've created new tables one for market and one for company and connected with first table, I've tried all types of connections, hoping that when I select only market M1 with no selections for companies I will get the value for second level M1 but I allways get the sum of M1, C1, C2 and C3.

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.