Forum Discussion

Suhel_Ansari's avatar
Suhel_Ansari
Helper V
4 years ago
Solved

Dynamic Chart Title based on User Login

Hi All,

DAX Expert I have very interesting Need for one of my report, I need Dynamic Chart Title based on the User login.

I have the table with Email, Visual Name, LatestRatingDate and Rating as seen in the screen print.
Now I Need Dynamic Chart Title based on the user login, the Title should be a combination of Visual Name along with Rating for LatestRatingDate date along with the No of Stars, for example if
1. User1 is login the Chart Tile should be “Chart3 (4) - ★ ★ ★ ★” similarly.
2. User4 login the Chart Tile should be “Chart4 (3.5) - ★ ★ ★”.
3. User6 login the Chart Tile should be “Chart2” Etc….
Table:

User1:

User4:

User6:

Please assit me with the DAX Measure so the Title change Dynamic when user log in. Thanks🙏

Regards

Suhel

  • Anonymous's avatar
    Anonymous
    4 years ago

    You can refer to this

     

     

     

    Star =
    VAR rating = MAXX(FILTER('table', 'table'[Email]=USERPRINCIPALNAME()), [Rating])
    RETURN
    REPT(UNICHAR(9733), INT(rating )) 
    & REPT(UNICHAR(9734), INT((rating - INT(rating ))/0.5))

     

     

     

     

     

     

5 Replies

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, Suhel_Ansari 

    You could Using the username() or userprincipalname() DAX function.

    Then  Save, and publish your solution to Power BI. In Power BI service go to security setting of the data set you just published.

    As you can see every user only see the transaction that he handled and his record. 


    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.

    • Suhel_Ansari's avatar
      Suhel_Ansari
      Helper V

      v-yalanwu-msft  , I know that however i need a measure to get the latest reating input from user to add dynamic Title in chart. Thanks

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, Suhel_Ansari ;

    You could create a measure 

    Measure = 
    var _a=CALCULATE(MAX('Table'[Visual Name]) ,FILTER('Table',[LatestRatingDate ]= CALCULATE(LASTDATE('Table'[LatestRatingDate ]),FILTER(ALLSELECTED('Table'),[Email ]=MAX([Email ])))))
    var _b=CALCULATE(MAX('Table'[Rating]) ,FILTER('Table',[LatestRatingDate ]= CALCULATE(LASTDATE('Table'[LatestRatingDate ]),FILTER(ALLSELECTED('Table'),[Email ]=MAX([Email ])))))
    return 
    IF(MAX('Table'[Rating])=BLANK(), _a,_a & "("&_b&")")
    &"-"&SWITCH(ROUNDDOWN(_b,0),1,"★",2,"★★",3,"★★★",4,"★★★★",5,"★★★★★")

    Then apply it into title fx.

     

    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.

  • Anonymous's avatar
    Anonymous
    Not applicable

    You can refer to this

     

     

     

    Star =
    VAR rating = MAXX(FILTER('table', 'table'[Email]=USERPRINCIPALNAME()), [Rating])
    RETURN
    REPT(UNICHAR(9733), INT(rating )) 
    & REPT(UNICHAR(9734), INT((rating - INT(rating ))/0.5))