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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
dh76_PBI
Frequent Visitor

How to keep filters on table visualization when adding a new measure

Hi all, 

 

I have a problem where when I add a measure to a table visualization, the slicers affecting the visualization seem to stop working.  

 

I have my data in a snowflake schema. I am illustrating using example data. In reality, I have several more dimension tables. In this case, however, let's pretend we have one fact table, a Location table, and a lookup table that connects to the Location table. An example of this schema is seen below. 

 

dh76_PBI_0-1672780664958.png

 

Here is the example Fact Table: 

dh76_PBI_1-1672780923497.png

 

I have several groups in several locations competing in challenges. There is a Challenge Start Date and an optional Challenge End Date. If the Challenge End is blank, then the challenge is ongoing and the Status within the Fact Table is "Closed". Some groups have received a "Penalty" (1= penalty applied, 0=no penalty).

 

Here is the Location table:

dh76_PBI_2-1672781016005.png

And the Lookup Table: 

dh76_PBI_3-1672781055984.png

 

When I insert a table visual containing Region from the Lookup table and Division from the Location table, it looks like this:

dh76_PBI_7-1672782813111.png

The above visualization can be filtered by District as shown below:

dh76_PBI_4-1672781129430.png

I have created two measures: one to count the Open challenges, and one to sum the number of Open challenges receiving penalties. These measures are written as follows:

Count Open = CALCULATE(COUNT('Fact Table'[ID]),'Fact Table'[Status] = "Open")
Sum Penalty Open = CALCULATE(SUM('Fact Table'[Penalty]),'Fact Table'[Status] = "Open")​

 

The numbers make sense in my visual, and the table can still be filtered by district (in the below example, Division B is missing because its challenge was Closed, and this table is looking only at Open challenges).

 

dh76_PBI_5-1672781432716.png

However, when I create a measure that outputs a ratio using the measures I created above and add it to the table visualization, the District filter no longer applies. 

 

The KPI is written as follows:

KPI Penalty Open = 1 - ([Sum Penalty Open]/[Count Open])

 

 

 

This is the resulting Table visualization:

dh76_PBI_6-1672781600668.png

As you can see, it is showing a result for all Regions. Only Divisions A, B, and C are in District 1, corresponding with Regions AB and AC. Howver, despite the District filter being applied, all Regions are shown in the table visual. How do I prevent this from happening?

 

I believe this may have something to do with how zeros are calculated, but I am at a loss.

Here and here are two forum answers which seemed close, but I didn't 100% understand how this applies to my case. 

 

Thank you in advance. 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @dh76_PBI 

Yes, this is indeed to do with zeros, specifically that BLANK is equal to zero, so that 1 - BLANK evaluates to 1 or 100%.

 

You could rewrite your measure a few ways to avoid returning a result when the ratio of the two measures is blank (I would probably prefer the first):

 

KPI Penalty Open =
VAR PenaltyOpen =
    [Sum Penalty Open]
VAR CountOpen =
    [Count Open]
RETURN
    DIVIDE ( CountOpen - PenaltyOpen, CountOpen )

 

or

KPI Penalty Open =
IF (
    NOT ISEMPTY ( 'Fact Table' ),
    1 - DIVIDE ( [Sum Penalty Open], [Count Open] )
)

or

KPI Penalty Open =
VAR PenaltyOpen =
    [Sum Penalty Open]
VAR CountOpen =
    [Count Open]
VAR Ratio = DIVIDE ( PenaltyOpen, CountOpen )
RETURN
    IF (
        NOT ISBLANK ( Ratio ),
        1 - Ratio
    )

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
IIPowerBlog
Helper I
Helper I

Hi @dh76_PBI  while I fully agree with @OwenAuger  and the solution, maybe this is simpler than expected:

Try the simple following steps: 

First:

1a. Your Lookup Table should include the ID column of the Location table 

OR

1b. Your Location Table should include the Region ID

Have you related these two tables correctly? The ID column of the Location table has to be your KEY 

 

Then (optinal if the first doesnt work out!) 

1. Instead of the COUNT measures, use COUNT directly on the fields 'Open' and 'Penalty Open' on the Visualization of your table. 

2. For your KPI calculation create a calculated field.

3. Remove the measures from your table and add the Calculated Field from step 2. 

 

Does this work?

 

OwenAuger
Super User
Super User

Hi @dh76_PBI 

Yes, this is indeed to do with zeros, specifically that BLANK is equal to zero, so that 1 - BLANK evaluates to 1 or 100%.

 

You could rewrite your measure a few ways to avoid returning a result when the ratio of the two measures is blank (I would probably prefer the first):

 

KPI Penalty Open =
VAR PenaltyOpen =
    [Sum Penalty Open]
VAR CountOpen =
    [Count Open]
RETURN
    DIVIDE ( CountOpen - PenaltyOpen, CountOpen )

 

or

KPI Penalty Open =
IF (
    NOT ISEMPTY ( 'Fact Table' ),
    1 - DIVIDE ( [Sum Penalty Open], [Count Open] )
)

or

KPI Penalty Open =
VAR PenaltyOpen =
    [Sum Penalty Open]
VAR CountOpen =
    [Count Open]
VAR Ratio = DIVIDE ( PenaltyOpen, CountOpen )
RETURN
    IF (
        NOT ISBLANK ( Ratio ),
        1 - Ratio
    )

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thank you! This worked. 

 

I also used the solution from here for some of my other measures, in case this helps others. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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