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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Nyansapo
Frequent Visitor

Auto-exist and duplicated measure problem when using two Dim tables in a visual

Dear PBI community, 
I searched a lot about this issue on the forum and elsewhere, and I couldn't find the solution. Here is the situation. 
Let's first present the data. I created a simple fake data model to illustrate the problem I'm encountering. 

 

I have four tables in my model 

Three dimension tables :

  • Interviewer
  • Office
  • Calendar

One fact table :

  • Transactions

Here is the Interviewer table (dim)

Interviewer IDOffice IDInterviewer Name
11Paul
21John
32Anne
42Gabriel
53Alain
63Chrystine
74Marie
84Steve

 

Here is the Office table (dim) :

Office IDOffice name
1Montreal
2Ottawa
3Toronto
4Vancouvert

 

Here is the calendar table (dim) :

Date
01-Nov-23
02-Nov-23
03-Nov-23
04-Nov-23
05-Nov-23

 

Here is the Transaction table (fact) :

Transaction IDTransaction dateInterviewer IDOffice IDSample Unit IDResponse Outcome
101-Nov-231110000
201-Nov-232110001
301-Nov-233210010
401-Nov-234210040
502-Nov-235310011
602-Nov-236310041
702-Nov-237410031
802-Nov-238410030
903-Nov-233210030
1003-Nov-234210021
1103-Nov-235310060
1203-Nov-236310011
1304-Nov-232110020
1404-Nov-233210040
1505-Nov-232110060
1605-Nov-233210051
1705-Nov-234210081
1805-Nov-235310010
1905-Nov-236310051
2005-Nov-237410070
2105-Nov-238410080
2205-Nov-236310070
2305-Nov-232110061

 

Here is my data model :

Nyansapo_0-1700861078760.png

 

Each Interviewer belongs to only one Office. Each interviewer have some transactions in the Transaction table.  

My basic measure is the number of responses by Interviewer. The number of response is defined as the number of unique Sample Unit ID for which we have Response Outcome = 1, which correspond to the following measure : 

 

 

 

 

 

Number Responses = 
CALCULATE(
    COUNTROWS(
        VALUES(Transactions[Sample unit ID])
    ),Transactions[Response Outcome] = 1
)

 

 

 

 

 

With this measure, I can create the simple table below that works properly :

Nyansapo_1-1700861428815.png

The problem comes when I want to add the total number of response by Office in the same table. I use the following measure to do so : 

 

 

 

 

 

Number Responses Office = 
CALCULATE(
    [Number Responses],
    ALLSELECTED(Interviewer)
)

 

 

 

 

 

My problem may be in this formula, but I need to use ALLSELECTED() filter function because I need to be able to modify this measure from the external slicers. Here is the result I get when I add this measure in my table : 

 

Nyansapo_2-1700861662262.png

As you can see, since I'm using two columns from two different dim tables, the Auto-Exact feature is disabled and I get the full cardinality of the tables Interviewer and Office (all possible combinations). The values of the measure "Number Responses Office" are accurate but it created a lot of impossible combinations of Interviewer and Office. How can I avoid this ? I don't want to manually filter out the rows where "Number Responses" = 0, because an interviewer may have no response, ans still be a valid data point. I would like to correct my measure so that it do not create all the impossible combinations of interviewers and offices. 

 

You can acces my PBIX fiel here : 

https://drive.google.com/file/d/1SoKd0ze7xRII27cY5vtgNDkavOaiSZID/view?usp=sharing

Please let me know if the link doesn't work. 

 

Any help will be much appreciated!

Thanks, 

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

you don't really need DAX for that.  But a small change to the data model is required.

View solution in original post

But in reality, in my real data, I don't know the office to which an interviewer belong

Then you cannot include both in the same visual.

View solution in original post

6 REPLIES 6
lbendlin
Super User
Super User

you don't really need DAX for that.  But a small change to the data model is required.

Hi @lbendlin ,

Thanks a lot for your quick reply! Your solution definitly works in this context, but here is my question : How if I would not have had Office ID in my Interviewer dim table? Let say we wouldn't know who is working where, but would only have the actual transactions in the fact table. I would like to be able to set my measure or my visual so that Power BI do not create row conbinations of Interviewers and Offices that do not exist in the fact table. This is a situation I often encounter. Is there any ways to do that?

I can of course extract the data from the fact table and feed it into my dim table, but would really like to avoid this kind of manipulation.

 

Thank you very much! 🙂

The data model needs to follow the business scenario.  If your business scenario changes then you need to adjust your data model accordingly.

Hi @lbendlin , 
Thanks for your reply. Well, I made a mistake by adding the field Office ID to the Interviewer table. I did that only to show clearly that each Interviewer belong to an office. But in reality, in my real data, I don't know the office to which an interviewer belong, and I can only rely on the fact table. 

 

So in the specifc business scenario I'm refering to, what would you suggest? 

 

I'm sure there are a lot of scenario like this one, and I guess these is a relatively easy solution to fix this problem, but can't find it... 

 

Thank you very much, 

But in reality, in my real data, I don't know the office to which an interviewer belong

Then you cannot include both in the same visual.

Hi @lbendlin ,
Thanks for the input, I really thought it was possible, I thought there would be a way to get this information from the fact table (without explicitly populating the dim table with it), but now that I think about that, your answer make sense. 

 

Thanks a lot for your time and information, you got me out of my misunderstanding! Really appreciate! 🙂

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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