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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ragnezza
Frequent Visitor

Blank Values when multiple filters are applied

Hello - I have a simple dataset that looks like this:

CategorySub-CategoryClassValue XXValue YY
AAAX1A10002000
AAAX2A4002500
AAAX3B2000300
BBBX2A50001000
CCCX1B1501200
CCCX2B35010000
CCCX3A300800

 

Then I have a summary table that looks like this:

CategoryValue A (=Value XX/2)Value B(=Value YY/2)
AAA17002400
BBB2500500
CCC4006000

 

Then I have two filters, one for Value A (Filter A) and one for Value B (Filter B), that are the result of the concatenation of:

Filter A = "Class" + "Sub-Category" (ie. A-X1, A-X2, B-X3,...)

Filter B = "Class_duplicate" + "Sub-Category_duplicate" (ie. A-X1, A-X2, B-X3,...)  --> I created a duplicate field for both "Class" and "Sub-Category" to avoid interference between the two filters

One of my goals was to apply Filter A only to Value A (with Value B not impacted by any selection) and Filter B to apply only to Value B (with Value A not impacted by any selection). I was able to accomplish this with the following measures:

Value A = CALCULATE( DIVIDE(Value XX,2), ALL(Table_name, Class, Sub-Category) )

Value B = CALCULATE( DIVIDE(Value YY,2), ALL(Table_name, Class_duplicate, Sub-Category_duplicate) )

This works only if:

  • I apply one Filter at a time OR
  • if the selected combination of "Class"+"Sub-Category" from both filters is the same

 

But considering that my summary table is at the "Category" level, while my filters are at the "Class"+"Sub-Category" level, the PROBLEM is if:

  • I make a selection from both filters AND
  • the combination of "Class"+"Sub-Category" is different between the two filters, which will return blank values in my summary table for both Value A and Value B.

 

I tried combining different functions inside the measures Value A and Value B, but with no success.

I hope I made it clear to understand, any recommendation/hint will be greatly appreciated.

 

Thanks!

Davide

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @ragnezza ,

 

Calculated tables are not used for dynamic filtering, you can create a slicer and measure that doesn't matter to affect the table visual.

 

Here are the steps you can follow:

1. Create calculated table.

Slicer_Table =
SUMMARIZE(
    'Table','Table'[Class],'Table'[Sub-Category])

vyangliumsft_0-1714101019535.png

2. Create measure.

Value A =
var _select=SELECTEDVALUE('Slicer_Table'[Class])
var _selectsub=SELECTCOLUMNS('Slicer_Table',"sub",'Slicer_Table'[Sub-Category])
return
IF(
    ISFILTERED('Slicer_Table'[Class])&&NOT(ISFILTERED('Slicer_Table'[Sub-Category])&&_select="A"),
    DIVIDE(
    SUMX(
        FILTER('Table',
        'Table'[Class]="A"),[Value XX]),2),
    SUMX(
        FILTER('Table',
        'Table'[Class]=_select&&'Table'[Sub-Category] in _selectsub),[Value XX])    
        )

 

Value B =
var _select=SELECTEDVALUE('Slicer_Table'[Class])
var _selectsub=SELECTCOLUMNS('Slicer_Table',"sub",'Slicer_Table'[Sub-Category])
return
IF(
    ISFILTERED('Slicer_Table'[Class])&&NOT(ISFILTERED('Slicer_Table'[Sub-Category])),
    DIVIDE(
    SUMX(
     'Table',
        [Value YY]),2),
    SUMX(
        FILTER('Table',
        'Table'[Class]=_select&&'Table'[Sub-Category] in _selectsub),[Value YY])    
        )

3. Result:

If only [Class] is selected, it is displayed according to your conditions:

vyangliumsft_1-1714101083743.png

If both slicers are selected, the result is realized based on the value of the slicer:

vyangliumsft_2-1714101083744.png

 

Best Regards,

Liu Yang

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

Thanks @v-yangliu-msft for spending time to look into this and for providing a solution, much appreciated!


I'm not there yet, but I'm pretty close to it. These are my differet scenarios:

A) NO FILTERS APPLIED
Original view with no filters applied

ragnezza_0-1714150291332.png

B) ONE FILTER APPLIED
"Filter for Value A only" applied (it applies only to Value A, while Value B reamins unchanged)

ragnezza_1-1714150413930.png

"Filter for Value B only" applied (it applies only to Value B, while Value A remains unchanged)

ragnezza_2-1714150526480.png

C) BOTH FILTERS APPLIED WITH THE SAME VALUE
This will filter out both Value A and Value B

ragnezza_3-1714150626163.png

D) BOTH FILTERS APPLIED WITH DIFFERENT VALUES --> my challenge
Different selections are made in "Filter for Value A only" and "Filter for Value B only" and because there are no records in common, the result is blank

ragnezza_4-1714150716025.png

It looks like I have somehow to skip the level of hierarchy in the filters (Class and Sub-Category) and stick to the Category level, which is the highest level of the hierarchy.

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors