Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I created a measure that totals up 'Logins' per clientID a month.
But now I want to create another measure that assigns a 'level of activity' based on the # of monthly logins
Low = less than 5
Medium = between 5 - 10
HIgh = 10+
I believe I need to create it using a switch but I'm not sure how to set it up.
Solved! Go to Solution.
@bigfun ,
Yes, SWITCH Statement is how I would approach this as well:
LevelofActivity = SWITCH(
TRUE(),
[Monthly Logins] > 10, "High",
[Monthly Logins] >=5, "Medium",
"Low" )
The last line, is your "else" condition. You can specify your third condition <5 if you want to make it clearer to yourself or others.
Hope this helps.
Regards,
So i am not sure why... But all the 'Activity Status' are showing low... I'm not sure why it isn't evaluating the number and assigning the status correctly.
@bigfun ,
The LevelofActivity is written as a Measure not a Calculated Column.
If you drag this Measure into your Visual in your Original Post, it should work as intended.
As a Calculated Column, it is evaluating each Row to 1, hence "low". I believe this is what's happening.
@bigfun ,
Yes, SWITCH Statement is how I would approach this as well:
LevelofActivity = SWITCH(
TRUE(),
[Monthly Logins] > 10, "High",
[Monthly Logins] >=5, "Medium",
"Low" )
The last line, is your "else" condition. You can specify your third condition <5 if you want to make it clearer to yourself or others.
Hope this helps.
Regards,
This is perfect... now I just need to figure out how to free up or not use as much memory processing it.. haha
@bigfun ,
Glad I could help. I use SWITCH throughout all of my numerous reports. Have never had an issue with memory or resources. Perhaps something else in your model is causing this. Unfortunately, this is out of my scope.
Curious if you have even put a condition on a switch statement.. For example:
I have a column that has a version# 1.0, 2.0, etc, and I only want to run the switch statement on the rows that are version 2.0.
@bigfun ,
You can try this a couple of different ways:
LevelofActivity = SWITCH(
TRUE(),
[Version#] <> 2.0, Blank(), // or "Not Applicable" or whatever....
[Monthly Logins] > 10, "High",
[Monthly Logins] >=5, "Medium",
"Low" )
If that doesn't work, then apply the condition to each line of conditions:
LevelofActivity = SWITCH(
TRUE(),
[Version#] = 2.0 && [Monthly Logins] > 10, "High",
[Version#] = 2.0 && [Monthly Logins] >=5, "Medium",
[Version#] = 2.0 && [Monthly Logins] < 5 "Low" )
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
55 | |
37 | |
34 |
User | Count |
---|---|
99 | |
56 | |
53 | |
44 | |
40 |