Forum Discussion

campelliann's avatar
campelliann
Icon for Post Patron rankPost Patron
4 years ago

Inactivating Relationship DAX differs from Physically inactivation

Hi there,
 
In the below measure the result is not quite the expected (very subtle difference), but if I physically inactivate the relationship between Table TicketStatus and Tickets the result is correct. In the measure in bold I also inactivate this relation with crossfilter, so why isnt this working? [UPDATE - Solution 1 does not work, Solution 2 does work, but I do not understand why)

Many thanks 

1) This does not work

Calculate
(Countrows('WI in period'),'WI in period'[Hours_consumed]=0, NOT'WI in period'[LastMonthStatus] IN {7,8},Filter(Tickets,Tickets[CreatedDate(Dateformat)]<max('Calendar 2'[Date])),CROSSFILTER(TicketStatus[Id],Tickets[TicketStatusID],None),CROSSFILTER(TicketType[Id],Tickets[TicketTypeID],None),CROSSFILTER(TicketUrgency[Id],Tickets[TicketUrgencyID],None),USERELATIONSHIP(Tickets[Id],'WI in period'[Id]))

2) This works (wrapping calculate with the crossfilter again)

calculate(Calculate(Countrows('WI in period'),'WI in period'[Hours_consumed]=0, NOT'WI in period'[LastMonthStatus] IN {7,8},Filter(Tickets,Tickets[CreatedDate(Dateformat)]<max('Calendar 2'[Date])),CROSSFILTER(TicketStatus[Id],Tickets[TicketStatusID],None),CROSSFILTER(TicketType[Id],Tickets[TicketTypeID],None),CROSSFILTER(TicketUrgency[Id],Tickets[TicketUrgencyID],None),USERELATIONSHIP(Tickets[Id],'WI in period'[Id])),CROSSFILTER(TicketStatus[Id],Tickets[TicketStatusID],none))



3 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi campelliann 

    yes I noticed this behavior. In some cases even with USERELATIONSHIP which failed to automatically deactivate the active relationship and I had to manually CROSSFILTER the active relationship to "None". In some cases had to do that by wrapping the first CALCULATE with another one. Still have no explanation of this behavior. 

    • campelliann's avatar
      campelliann
      Icon for Post Patron rankPost Patron

      Hi there tamerj1 , but what is the difference between my "solution 1 and solution 2". Why does Crossfilter none in the "middle" of the calculate does not work ( I have used this way many times), but wrapping around in solution 2 does work? Does it have to do with evaluation order or something?


      Many thanks

      • tamerj1's avatar
        tamerj1
        Icon for Community Champion rankCommunity Champion

        campelliann 
        No they're supposed to be applied at the same time. But this may not be possible technically therefore, need to be applied in two steps using two CALCULATE's