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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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