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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ruxandraalina
Helper I
Helper I

Ignore relationship between two tables

Hello, 

 

I have a date dimension table and a fact table with ticket information - there is a relationship between the Date table and the Created Date from the fact table. 

 

On a specific page, I have

-multiple tables with Date (from the dimension table) and measures (from the fact table) and

-a Date slicer (from the dimension table).

 

Some of these measures should be filtered by

-Date (from the dimension table) as defined by the active relationship

-others should be filtered by the same Date (from the dimension table), but use a different "relationship", namely Date - Closed Date

 

I have adjusted the DAX formula (below script) for the second group of measures and the table visual displays information as intended - measures by Date (from the dimension table), where Date actually refers to Closed Date, not Created Date.

 

However, when I manually select specific months from the Date slicer, the table visual ignores my adjustments in DAX and goes back to using the active relationship. 

 

Is there any way to further adjust the DAX formula so that it fully ignores the active relationship, both inside the visual and inside the slicer?

 

# Tickets with Positive Feedback = 
var ctx_date = values('[F] Date'[Month])
return
CALCULATE(
    DISTINCTCOUNT(Incidents[Number]), 
    FILTER(
        //Incidents,
        ALLSELECTED(Incidents), 
        Incidents[completionDate] <> BLANK() 
        && Incidents[CompletionDateMonth] in ctx_date
        && Incidents[feedbackRating] in {4, 5}
        && Incidents[CSAT Is Valid for SD] = TRUE()),
        CROSSFILTER('[F] Date'[Date], Incidents[CallDate_clean], None)
    
 

Thank you!

 

 

 

2 REPLIES 2
Greg_Deckler
Super User
Super User

@ruxandraalina You need to use the USERELATIONSHIP function.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

Thanks! I actually tried it before submitting this post, but it's not giving the intended result. 

 

ruxandraalina_0-1669201314679.png

The first two tables use Created Date and Closed Date from the fact table, while the third one uses Month from the dimension table. 

 

To double check the results, I have created an additional simple formula (# Tickets with Pos Feedback v2) that is not connected to the relationship. The point was to double check whether the results in the middle table or equal to the results in the last table, but they are not. 

 

Is there anything wrong in my DAX formula for the third table?

 

# Tickets with Positive Feedback = 
var ctx_date = values('[F] Date'[Date])
return
CALCULATE(
    DISTINCTCOUNT(Incidents[Number]), 
    USERELATIONSHIP(Incidents[CompletionDate_clean], '[F] Date'[Date]),
    FILTER(
        Incidents,
        //ALLSELECTED(Incidents), 
        Incidents[completionDate] <> BLANK() 
        && Incidents[CompletionDate_clean] in ctx_date
        && Incidents[feedbackRating] in {4, 5}
        && Incidents[CSAT Is Valid for SD] = TRUE()
        //&& USERELATIONSHIP(Incidents[CompletionDate_clean], '[F] Date'[Date])
        //CROSSFILTER('[F] Date'[Date], Incidents[CallDate_clean], None)
        //REMOVEFILTERS('[F] Date')

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.