Forum Discussion
Rank In PBI
Hi , Anonymous
Thanks for your quick response! According to your description, this is my understand:
If this is the same as yours table structure and the end result is right, you can refer to :
(1)We can create two measures:
MAX views = var _t = SUMMARIZE('Table','Table'[Content Title],"value", SUM('Table'[Views]))
var _t2 = TOPN(1,_t , [value] , DESC )
return
SUMX(_t2 , [value])MAX COntent Title = var _t = SUMMARIZE('Table','Table'[Content Title],"value", SUM('Table'[Views]))
var _t2 = TOPN(1,_t , [value] , DESC )
return
maxx(_t2,[Content Title])
(2)Then we can put it on the visual and just put the [News type] as the dimension only!
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi Aniya zhang,
Thanks for being patient and replying to my problem
| News Type | Content Title | Views |
| Global | team to lead Company through increasingly challenging external environment | 11,900 |
| Region | Competitors are coming | 4,596 |
| Region | Team at exhibition | 3,794 |
I just need to show this
only one top content title and it's respective view for each news type
but when i am adding created by name, published date dimension columns into the table
it's showing many values
I'll paste the dax i have used below
Top View = IF ( ISINSCOPE( 'Fact Content'[content_title] ), RANKX ( CALCULATETABLE ( VALUES ( 'Fact Content'[content_title] ), ALLSELECTED( ( 'Fact Content'[content_title] ), 'Fact Content'[Filtered News Type]) ), 'Fact Content'[Month Filter] ) )
the below is the output i am getting
But after adding created by name , published_at columns it's splitting down to many rows like below
Please helpp
It's very important for me
Thanks
sai
- Anonymous3 years agoNot applicable
Hi,
ContentId date published_at metadata user_id id Sum of nb_content_views Sum of nb_content_likes Sum of nb_content_comments content_title content_type_name Filtered News Type 54020412 6/28/2023 0:00 5/12/2023 17:59 Video 45037090 df826ded7681bae5d15e18b56ac242e8 1 0 0 We invited mothers for an unforgettable experience News Regional News 59300990 6/1/2023 0:00 5/19/2023 21:22 Training 45037031 6ef863e1d58ac36e4af26ccab7afe429 1 0 0 2023/06/07: Masterclass: Working Effectively Across Cultures Events 59300990 6/1/2023 0:00 5/19/2023 21:22 Training 45037031 79ba432f759c4b0b7585ba40b395c589 1 0 0 2023/06/07: Masterclass: Working Effectively Across Cultures Events 59300991 6/2/2023 0:00 5/19/2023 21:22 Training 45037090 baec93e847a9ce0b6120c7ec752a6900 1 0 0 2023/06/07: Masterclass: Working Effectively Across Cultures Events 45317681 6/15/2023 0:00 5/31/2023 22:00 Engagement 45037031 867d3eca5c6269c5aa8b0c93cb695f90 1 0 0 News 45317681 6/15/2023 0:00 5/31/2023 22:00 Engagement 45037031 ce5d58aeeb337248c65cd492111453b3 1 0 0 News 49851883 6/3/2023 0:00 5/31/2023 22:00 Scholarships 45037031 3aa91a5dced42d77103930d97782f972 1 0 0 Deadline: June 15 - 2023 Student Awards Reminders 49851883 6/3/2023 0:00 5/31/2023 22:00 Scholarships 45037031 98d6acfcc69c0c706e1eb1971a1beecf 1 0 0 Deadline: June 15 - 2023 Student Awards Reminders 55549280 6/15/2023 0:00 6/5/2023 22:00 Wellness 45037031 83d584a5ac9132f424c907fc93d4acad 1 0 0 News 55549280 6/15/2023 0:00 6/5/2023 22:00 Wellness 45037031 8f463c95c5c415f43d4e0bcfab9f5ab6 1 0 0 News 46539003 6/27/2023 0:00 6/15/2023 21:47 Purpose and Values 45037031 baf4cd9dfa35724b07046b52c1e8d28b 1 0 0 2023/06/27: Join our Masterclass Events 46539003 6/27/2023 0:00 6/15/2023 21:47 Purpose and Values 45037031 d5014526c27083e592727bf8a1cf062f 1 0 0 2023/06/27: Join our Masterclass Events 57337827 6/27/2023 0:00 6/21/2023 22:00 Benefits 45037031 5c6cd758468b2f317e0cf77fff99db1d 1 0 0 News 57337827 6/27/2023 0:00 6/21/2023 22:00 Benefits 45037031 73b2da007de296674bc8bdc20b5c4d3c 1 0 0 News 52336239 6/30/2023 0:00 6/25/2023 22:00 Welcome 45037090 db8f4d5b62b7635acf6a2906a04af38e 1 0 0 New Iconic Emblem News Global News 52594039 6/28/2023 0:00 6/27/2023 14:28 Welcome 45037090 ed801576fd2f050817bc29cf481c5022 1 0 0 Your Way: ‘Easy to Always Be Charged’ News Global News 61743063 6/5/2023 0:00 7/4/2023 7:00 Programs 45037031 9c3c05873d4f44899ea003afbcd835a5 1 0 0 News TThis si the sample data
For one date there are many published at dates - v-yueyunzh-msft3 years agoCommunity Support
Hi , Anonymous
Thanks for your quick response! According to your screenshot and your dax code . The [Month Filter] measure seems to calculate the views in the previous month . And the [Top View] is used to filter the highest views in your table visual and it work good in your screenshot . And the issue is that when you put the other field like [Created By Name] or the [Published Date] , the table visual will not work.
For this, i think this not the reason for your [Top view] measure. Due to your Views is the previous month so you can not just directly put the other fields to the visual.I also test it in my side , but i still have no sample data as the same as yours so I can't completely guarantee that my situation is exactly the same as yours.
This is my test data and my understand now:
For this i use your two measures you provided and it work good in my side .If you want to add the [Created By Name] or the [Published Date], you may need to create measures to realize it:
Created Name Measure = CALCULATE( MAX('Fact Content'[created by name]) , MONTH('Fact Content'[date]) = MONTH(MAX('Fact Content'[date])) - 1)
Published Date Measure = CALCULATE( MAX('Fact Content'[published_at]) , MONTH('Fact Content'[date]) = MONTH(MAX('Fact Content'[date])) - 1)
Then we can get the right value due to it is from previous month so we can not just directly put it on the visual.
If this method still can not help you solve this case , can you just share me some sample data as the same as yours in a table format , and your end result you need also.Inconsistencies in data structures can complicate things very much, and [Filtered News Type] also appears in your DAX, I'm not sure what the relationship is to [News Type]?Hope this solution can help you!
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- Anonymous3 years agoNot applicable
Hi,
Thanks for replying,
when I am using the dax you have given the output is like belowIt's not showing name and dates for all news types, only for one....please reply
Filtered news type is created column based on one more column
I am taking everything from only one table that is Fact Content
I don't know, why nothing is working here, maybe group by works ....
Please help
Thankss in advance - v-yueyunzh-msft3 years agoCommunity Support
Hi, Anonymous
Thanks for your quick response ! And sory for that this dax code still can not work , it is very strange For this dax "Created Name Measure = CALCULATE( MAX('Fact Content'[created by name]) , MONTH('Fact Content'[date]) = MONTH(MAX('Fact Content'[date])) - 1)" :
This is just calculate the last montn "created by name" as the same logic as your [Month Filter] measure.And for the "Views" in your visual , in my undersand , this is just the [Month Filter] measure, right?
And only one situation for there is only one poosible is that the [created by name] and [published Date] is contains blank in your table?
And I'm not sure what you want to get the following [created by name] and [published Date], I used the same logic as your [Month Filter] in dax.So can you send me the download link of the sample .pbix (you can cr eate a test .pbix and make this isssue in it ,and also give me the end result !) you have the error problem with? Then tell me the data and calculation logic you need to display, which can make the problem simpler and clearer? 😁Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
😘 - v-yueyunzh-msft3 years agoCommunity Support
Hi , Anonymous
Thanks for the sample data very much!!! But where is the "News Type" in your visual and i can not find it in the sample data....
And dose this [Views] in your table is using your [Month Filter] measure?
And dose your actually need is to see the highest views in the previous month?And i see your sample data there is many blank value in the [Filtered News Type] and [Content Type]...
And i do not surely understand which you want to group by if used the [Filtered News Type] and [Content Type]?
I'm really sorry, I checked your sample data, but I'm still not very clear about your needs. . .And you want to get [Created by Name] and [Published Date], but is it possible for each [News type] and [Content Title] to have multiple [Created by Name] and [Published Date]? So which one do you want to get?If possible, can you tell me about your business logic and the final result you want?Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly