Forum Discussion

PoojaG's avatar
PoojaG
Helper II
2 years ago
Solved

Flag a user based on few data points

I am creating a power bi report based on monthly survey data. One of the question is productivity gain. I want to identify users based on following criteria:

  • Number of survey taken is greater than 2
  • reported an upward or consistent number on Productivity gained (look at the sample data)
Survey DateUser productivity
1/1/2023A30
2/1/2023A30
3/1/2023A45
4/1/2023A33
1/1/2023B30
2/1/2023B35
1/1/2023C20
2/1/2023C30
3/1/2023C40
1/1/2023D45
2/1/2023D45
4/1/2023D45

 

Expected Output 

UserFlag Super User
AN
BN
CY
DY

I tried couple of DAX formula's but the output isn't what is expected in the above sample data.

5 Replies

  • Hello PoojaG,

     

    Can you please try this:

     

    1. Count Surveys per User

    Survey Count = COUNTROWS('Survey')
    

    2. Flag Users Based on Criteria

    Flag Super User = 
    VAR CurrentUser = 'Survey'[User]
    VAR SurveyCount = CALCULATE(COUNTROWS('Survey'), FILTER('Survey', 'Survey'[User] = CurrentUser))
    VAR FirstProductivity = CALCULATE(MIN('Survey'[productivity]), FILTER('Survey', 'Survey'[User] = CurrentUser), ALL('Survey'))
    VAR LastProductivity = CALCULATE(MAX('Survey'[productivity]), FILTER('Survey', 'Survey'[User] = CurrentUser), ALL('Survey'))
    RETURN
    IF(SurveyCount > 2 && LastProductivity >= FirstProductivity, "Y", "N")
    

    Hope this helps.

    • PoojaG's avatar
      PoojaG
      Helper II

      this solution may not consider all the in between survey results. only the first and the last.