Forum Discussion

newbie_powerbi's avatar
3 years ago

sumx and allselected

https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/ 

 

I can see that iteration on allselected creates a shadow context

I use ALLSELECTED inside SUMX 

so how can I handle my problem

I need the unique count of person whose tickets are open

which means I need to consider only 1 ticket for person when I have 2 open tickets

ticket which needs to be considered as latest open ticket (max of open_dt)

 

 

 

this is my dax for finding the unique count 

which results in total in table as correct but the values are still the same as my open ticket count measure

 

 

attaching my example file

https://drive.google.com/file/d/1G_sfyGqbAyCbxA359lShcC6z06zDWYIA/view?usp=share_link 

11 Replies

  • Thank you for directly sharing the PBI. This make it so easy for helping! 
    Do not forget to mark my solution, thank you 🙂
    Try this
    Measure 2 =
    MAXX(FILTER('Table','Table'[close_dt]=BLANK()),'Table'[open_dt])

    Measure 3 =
    COUNTX(FILTER('Table','Table'[close_dt]=BLANK()),'Table'[open_dt])

     

     
    • newbie_powerbi's avatar
      newbie_powerbi
      Icon for Helper II rankHelper II

      andhiii079845 

      sure, you have incorporated the logic of open inside the measure but my logic has mutiple conditions for open & my table has 10 millions rows

       

      I just added a simple logic for the understanding

      I need the same results using open ticket count measure

       

      thank you

      • andhiii079845's avatar
        andhiii079845
        Icon for Solution Sage rankSolution Sage

        Than change it like this:

        Measure 2 =
        MAXX(FILTER('Table','Table'[open ticket count]=1),'Table'[open_dt])
         
  • Your open_dt and close_dt columns are the reason for the current matrix. can you please share exactly how the matrix should look like?