Forum Discussion

Randcharles's avatar
Randcharles
Helper I
2 years ago

DAX context filter

Hello everyone, 

I have 2 tables :

  • Fct_Ticket : Reference, StartDate, Solved Date, End Date, Status, Teams
  • Dim_Date : Date, month, day

Between these 2 tables, I have 3 relations ( 1 à N) :

  • Dim_Date[Date] – Fct_Ticket[StartDate] ( Active)
  • Dim_Date[Date] – Fct_Ticket[SolvedDate] (Non active)
  • Dim_Date[Date] – Fct_Ticket[EndDate] ( Non active)

 

I need to get mesure based on the count of my solved tickets, so I have perfomed calcul by following 2 steps:

mes_Solved (intermediate calcul) = CALCULATE(COUNTROWS(Fct_Ticket),USERELATIONSHIP(Dim_Date[Date],Fct_ITOP[SolvedDate]))
then the final result is get by this one: 
mes_SolvedTicket= CALCULATE( [mes_Solved (intermediate calcul)],Dim_Statut[Status]=”Solved”)

However, when I try to display result fo this calcul on a table by applying date filter, I have only the result of my mesure SolvedTicket for the lastest week available from my data. 
The same result for the mesure based on EndDate for closedTicket.

Do you know how to fix this DAX calcul ?
Thanks in advance.

3 Replies

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    Randcharles 

     

    try this ; 
    mes_SolvedTicket=

    CALCULATE(

    COUNTROWS(Fct_Ticket),USERELATIONSHIP(Dim_Date[Date] , Fct_ITOP[SolvedDate]),

    Dim_Statut[Status]=”Solved”

    )

     

     

    let me know if this helps .

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠:

  • Hello Daniel29195 ,

    I have tried the formula, unfortunately it gives the same result as I had : 

    Maybe an error on my data models ? But I don't think so.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Randcharles 

     

    Please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.