cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper II

## 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 Date User productivity 1/1/2023 A 30 2/1/2023 A 30 3/1/2023 A 45 4/1/2023 A 33 1/1/2023 B 30 2/1/2023 B 35 1/1/2023 C 20 2/1/2023 C 30 3/1/2023 C 40 1/1/2023 D 45 2/1/2023 D 45 4/1/2023 D 45

Expected Output

 User Flag Super User A N B N C Y D Y

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

1 ACCEPTED SOLUTION
Super User

Hi,

PBI file attached.

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
5 REPLIES 5
Super User

Hi,

PBI file attached.

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Helper II

this works perfectly. thank you so much. I appreciate your help

Super User

You are welcome.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Super User

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.

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
Helper II

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

Announcements

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors