Forum Discussion

xiumi_hou's avatar
xiumi_hou
Post Partisan
5 years ago

URGENT - dax function not working

Hi all,

 

I have the month slicer, I was trying to calculate how many people activated at the begining of the seleced month. For example: when I selected April, I want to know how many people was used to be actived before or on the April 1st. However, the dax function return blank: each parent id represents 1 people

 
Activation before = CALCULATE(DISTINCTCOUNT(f_calls[Parent_id]),filter(f_calls,
f_calls[f_Cases.Activation_date_c]<min(d_date[Date])
 
),USERELATIONSHIP(f_calls[f_Cases.Activation_date_c],d_date[Date]))
 
Thanks a lot!

10 Replies

  • Hi, xiumi_hou 

     

    can you try the below?

     

    Activation before =
    CALCULATE (
    DISTINCTCOUNT ( f_calls[Parent_id] ),
    FILTER ( f_calls, f_calls[f_Cases.Activation_date_c] = MIN ( d_date[Date] ) ),
    USERELATIONSHIP ( f_calls[f_Cases.Activation_date_c], d_date[Date] )
    )
     
    Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
    • xiumi_hou's avatar
      xiumi_hou
      Post Partisan

      Thanks for the reply. It still shows blank. I want to calculate how many was active before or on the April 1st

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi, xiumi_hou 

         

        Oh... before or on the 1st day of the selected month??

        Or is it before the 1st day?

        I hope you can change as you wish.

        please include ALLSELECTED function inside the measure.

         

        Activation before =
        CALCULATE (
            DISTINCTCOUNT ( f_calls[Parent_id] ),
            FILTER (
                ALLSELECTED ( f_calls ),
                f_calls[f_Cases.Activation_date_c] <= MIN ( d_date[Date] )
            ),
            USERELATIONSHIP ( f_calls[f_Cases.Activation_date_c], d_date[Date] )
        )

         

        Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!