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
pbiOP1
Frequent Visitor

Create measure that ignores filters in a visual

Hello!

 

I am trying to create a chart that represents two series, but one of the series needs to represent all values in the table, regardless of whether those values are present or not in the other series.

 

My data come from two tables. The first one has a breakdown of expected income per office for each quarter of the year. Only one instance of each office is represented in this table, with a column per quarter, such as the example below:

 

TableA
OfficeIncomeObjectiveQ1IncomeObjectiveQ2
A1010
B1010
C1010
D1010
E1010

 

The other table has instances of the contracts signed throughout the year, with a code that links each contract and its amount with the office that it belongs to:

 

TableB
ContractOfficeIncomeDate
A1A5Q12019
B1B5Q12019
A2A5Q12019
C1C5Q12019
D1D5Q12019
E1E5Q12018

 

I want to show the total amount for the contracts signed during the current year, so I have a visual level filter on 'TableB'[Date].

 

My goal is to have a clustered bar chart, with one bar showing the total amount signed for 2019, and another bar showing the total objective for each quarter of 2019. However, the chart I have does not aggregate any data belonging to Offices that do not have contracts signed during the current year to the Total Objective bar, which means the figure on that bar remains inaccurate (in the example provided, the bar wouldn´t aggregate the 10 belonging to Office E, as that Office does not have any contracts signed during 2019).

 

So far, I have tried creating a measure using

CALCULATE(SUM('TableA'[IncomeObjectiveQ1]); FILTER(ALL('TableA'[Office])))

or variations of it (adding to the FILTER all columns on TableA, all columns of TableB, combinations of both)... to no avail: the Total Income Objective bar only shows data for offices that have contracts signed within the current year.

 

Can anyone tell me what am I doing wrong? I am fairly new to PBI, so I am sure this is easily solvable but I just can´t see it.

 

Thanks in advance! 🙂

5 REPLIES 5
v-frfei-msft
Community Support
Community Support

Hi @pbiOP1 ,

 

Please change the relationship between table A and B to both as the picture below.

Capture.PNG

 

To use ALLSELETED instead of All here.

 

all = CALCULATE(SUM(TableA[IncomeObjectiveQ1]),ALLSELECTED(TableA[Office]))

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Thanks a lot for the answer, !

I just realized I did not specify how the tables are linked to eachother, which might be the reason why the solution you propose does not work.

Both tables are linked through a third, intermediate table, as the codes in TableA are not exactly the codes on TableB.

 

So TableA is as follows:

 

OfficeIncomeObjectiveQ1IncomeObjectiveQ2
A1010
B1010
C1010
D1010
E1010

 

TableB is as follows:

 

ContractOfficeNameIncomeDate
A1AA5Q12019
B1BA5Q12019
A2AA5Q12019
C1CA5Q12019
D1DA5Q12019
E1EA5Q12018
A3AB5Q12019

 

And TableC is as follows:

 

OfficeOfficeName
AAA
AAB
BBA
CCA
DDA
EEA

 

And they are linked the following way:

PBI TablesLink.PNG

 

Does this change the problem significantly?

 

My apologies for the previously incomplete post, and thanks for your help!

Hi,

Show the exact result you are expecting in a Tabular format.  Once the Table is ready, you can create any visual you want.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @pbiOP1 ,

 

Did you created the relationship between tables like this?

 

2.PNG

 

Then I created the measure as below.

 

all = CALCULATE(SUM(TableA[IncomeObjectiveQ1]),ALLSELECTED(TableA[Office]))

 

 

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hello again, !

 

Thanks a lot for the help! The relationship I created is exactly the one you describe in your post and its attached images, and the measure works when I use in a standalone visual (i.e. it shows the whole amount under column "IncomeObjective Q1").

 

The measure, however, is still being affected by data in other series in a visual, so the series does not show any data under "IncomeObjectiveQ1" belonging to any Office that gets filtered out by not having Income during the current year.

This seems to happen to your measure as well, as the amount shown on the card should be "50" (10*5 offices), but is instead 40 (Office E´s data, which does not have income within 2019, gets filtered out, resulting in 50-10).

 

This is exactly what I want to do: being able to show a full series in a visual, which does not change when related series are filtered out.

 

Thanks again for all the help and support! 🙂

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.