Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

DAX

Hi All,

I'm trying to solve one User requirement in my power BI

I have a two tables 
one id Dim_Table and another is Fact_Table
In Dim table I have a column News and Content

In News I have Globe News, Locality News and Region News
and In content column there are differente contents under each News

In Fact_table I have views column

I have Related Dim_Table and Fact_Table with ID 

Here my requirement is:
whatever the content under each News type has highest views that content should be shown as Top View- Globe News for Globe News News type and same for Locality news and Region News
and whatever the content under each News type has lowest views that content should be shown as Low View- Globe News for Globe News News type and same for Locality news and Region News


Please help me

Thanks in advance

4 Replies

  • Anonymous , You use TOPN and Windows for that

     

    Learn Power BI: Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

     

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Amit, Thanks for replying
      That is not working as expected for mr , I'm sharing sample data with you

      NewsContentViews
      Globe NewsTesting is happening20
      Globe NewsTesting is done16
      Globe NewsInto Prod18
      Locality NewsLocal Tag #Localality News 215
      Locality NewsLocal Tag #Localality News 118
      Region NewsTesting Region News #129
      Region NewsTesting Region News #24
      Region NewsTesting Region News #36


      Here For Globe News I need to show only highest Content Views
      In heer For Globe News Highest Content Views is 20
      I need to show that Highest View Content only and also Views for that content
      Same for Locality News and Region News

      Please Help
      Thanks in advance

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated column.

    Flag =
    var _max=
    MAXX(
        FILTER(ALL('Table'),
        'Table'[News]=EARLIER('Table'[News])),[Views])
    var _min=
    MINX(
        FILTER(ALL('Table'),
        'Table'[News]=EARLIER('Table'[News])),[Views])
    return
    IF(
        'Table'[Views]=_max,
        "Top View- Globe News for"&""&'Table'[News],
    IF(
        [Views]=_min,
        "Low View- Globe News for"&""&'Table'[News]))

    2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      I have "News" and "Content" Columns in Dim table and "Views" column in Fact table

      I have given relationship between them using ID column

      Can you please give me the solution as I have mentioned above

      Thanks in advance