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
Anonymous
Not applicable

Help with measures and AutoExists

Hi,

 

I have a factless fact table called Milestone and a dimension table called Project. These look as follows and are joined off the PID column.

 

Project

PIDP_name
1Proj A
2Proj B

 

Milestone

PIDMIDDate
1123/03/2019
1229/03/2019
1316/04/2019
14 
15 
16 
17 
218/03/2019
2211/03/2019
23 
24 

 

I have a simple measure which counts the number of milestones for a project. It is as follows:

 

Measure = 
CALCULATE(
    COUNTROWS(Milestone),
    ALL(Milestone[MID])
)

 

 

When I create a table visual consisting of Milestone[PID], Milestone[MID], [Measure]. I get the expected result. Each PID, MID combination exists and the measure correctly counts the number of milestones.

 

Result Table Visual

Milestone[PID]Milestone[MID][Measure]
117
127
137
147
157
167
177
214
224
234
244

 

When I remove Milestone[PID] and replace it with the Project[P_name] I get the correct result but with combinations which should not exists (PID2 does not have milestones 5,6,7 ). From my understanding this is caused by the AutoExist feature not operating on columns in different tables and effectively creating a cross join.

 

Result Table Visual

Project[P_name]Milestone[MID][Measure]
Proj A17
Proj A27
Proj A37
Proj A47
Proj A57
Proj A67
Proj A77
Proj B14
Proj B24
Proj B34
Proj B44
Proj B54
Proj B64
Proj B74

 

 

How can I write the measure to get a result where only the correct combinations exist? I have found many articles explaining this "feature" but nothing explaining how to get around it. Creating a similar measure in my production model creates cross joins so big that Power Bi can't handle it.

 

Note that adding the P_name column to Milestone table is not possible and nor is including Milestone[PID] in the result visual.

 

Desired Result Visual

Project[P_name]Milestone[MID][Measure]
Proj A17
Proj A27
Proj A37
Proj A47
Proj A57
Proj A67
Proj A77
Proj B14
Proj B24
Proj B34
Proj B44

 

Many thanks!

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try to use following measure to achieve your requirement:

Measure = 
CALCULATE(
    COUNTROWS(Milestone),
    ALLSELECTED(Milestone[MID]),
    VALUES(Milestone[PID])
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try to use following measure to achieve your requirement:

Measure = 
CALCULATE(
    COUNTROWS(Milestone),
    ALLSELECTED(Milestone[MID]),
    VALUES(Milestone[PID])
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.