Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I have a dataset that looks like this:
UserName | UserEmail | ActionType | PostId |
user1 | user1@company.com | PostView | 1 |
user1 | user1@company.com | PostView | 2 |
user2 | user2@company.com | PostComment | 1 |
user2 | user2@company.com | PostView | 2 |
user2 | user2@company.com | PostView | 3 |
user3 | user3@company.com | PostView | 1 |
user4 | user4@company.com | PostView | 1 |
I'm trying to determine the top posts viewed. For example, using the data above, I would like to get the count of the PostId values and that would help me to determine the top posts being viewed. Based on the data above, I'm trying to display the top post views like this:
PostId | ViewCount |
1 | 3 |
2 | 2 |
3 | 1 |
I'm new to Power BI and can't quite figure out the best approach of getting this result. Any help is much appreciated!
Thanks,
CG
Solved! Go to Solution.
Hi, @codygros ;
Here are two methods about it.
First Method:
1.add a table visual then Postid set don't summarize and useremail set count(distinct).
2.set fiter on this visual. add ActionType then set Postview.
Method 2:
1.create a measure.
Measure = CALCULATE(DISTINCTCOUNT('Table'[UserEmail]),FILTER(ALLSELECTED('Table'),[PostId]=MAX([PostId])&&[ActionType]="PostView"))
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @codygros ;
Here are two methods about it.
First Method:
1.add a table visual then Postid set don't summarize and useremail set count(distinct).
2.set fiter on this visual. add ActionType then set Postview.
Method 2:
1.create a measure.
Measure = CALCULATE(DISTINCTCOUNT('Table'[UserEmail]),FILTER(ALLSELECTED('Table'),[PostId]=MAX([PostId])&&[ActionType]="PostView"))
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@codygros , Create a measure like
Top 1= calculate(max(Table[PostId]),TOPN(4,allselected(table[PostId]),calculate(count(Table[PostId])),DESC), values(table[PostId]))
Thanks for the response. I created a measure with the info that you provided and it is just returning a number. In my environment it is returned 35. Not sure if that is what you were expecting based on the code that you provided but I am looking to return one record for each PostId found in the table with the count of how many rows have that PostId value.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
105 | |
88 | |
73 | |
66 |
User | Count |
---|---|
124 | |
113 | |
98 | |
81 | |
72 |