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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Measure creates cartesian

I'm trying to understand why this measure is creating a cartesian product. It's simple to reproduce:

Two tables Dim and Fact. Dim has only a DimId column, fact has dimId and a date column.

 

Measure1:

MaxDate = max(fact[DateColumn])

Measure2:

DoSomeBusinessStuff = //check is max date in context is in future, if yes, do something, if no, do something else
VAR MaxDate = [MaxDate]
VAR MaxDateIsInFuture = [MaxDate] > TODAY()
RETURN
IF( MaxDateIsInFuture , 1+1 , 5*20 )

If I create a table viz out of dim.DimId and MaxDate, and then a slicer on dim.DimId - the resulting table respects the filter propagated from dimension. However, if I drop DoSomeBusinessStuff in, the table returns a cartesian of Fact+Dim tables, and for the life of me I don't know why.

 

In the DoBusiness measure it's the MaxDate > TODAY() that causes it, but I can't understand why that would.

 

Any help?

 

 

fact tablefact tabledim tabledim tablerelationshiprelationshipMax Date  - no catesianMax Date - no catesianDoBusiness - WHAT?DoBusiness - WHAT?

 

 

 

 

 

 

4 REPLIES 4
Marcin82
Frequent Visitor

Anonther question without a real answer. Such a great forum...

 What are you trying to do here? Where are the dim IDs coming from  - the ones placed on rows and columns? It looks like you have dim ID coming from both tables in this visual.   Why are you doing that and what do you expect to achieve?    The dim ID from your fact table will not filter your dimension table.   That is why you have a cartesean join



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

did you try to reproduce the issue here? takes a couple minutes to create the data model I've posted.

 

I've had no luck and it makes no sense to me. 

Anonymous
Not applicable

The two IDs on the visual are to demonstrate that the dimension filter is not passing to fact. Even if I take the id's off, the cartesian effect stays there - without showing the id's the resultset is even more confusing. 

 

The production version of this looks to MaxDate to see if the last date in filter context is in the future or not, and toggles the calculation returned, but comparing MaxDate to TODAY() causes the table to explode. Doesn't matter if it's table or matrix, doesn't matter if dimid's are actuall on the visual, the resultset in visual goes totally haywire and doesn't respect the filter from dim.DimId slicer. 

 

Give it a try - those two tables and a handful of values are all you need to get weirdness. I wish this forum allowed me to upload an example file. 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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