Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Render data based on IF true condition

Hello all! Trying hard to find a way to render data based on a single condition using IF operator:]   This query work: Table 3 = CALCULATETABLE ( SELECTCOLUMNS ( TimeReport, "Neukunden_Akq...
  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    4 years ago

    Hi Anonymous ,

     

    Unfortunately, it is impossible to hide the measure by this way.

     

    First, you want to show different data depend on the end user.

    Row-level security (RLS) with Power BI can be used to restrict data access for given users. So RLS is the best choice. It is best to read through the entire text to implement RLS. userprincipalname() and username() are always used with RLS.

     

    Second, username() and userprincipalname() are not support in calculate column and new table.

     

    Third, username() and userprincipalname() can be used in measure but measure not support return a table. But measure can use table during calculation process. For example

    Measure =
    VAR _table3_from_your_code =
        SELECTCOLUMNS(
            TimeReport,
            "Neukunden_Akquise_Systeme", TimeReport[Neukunden_Akquise_Systeme],
            "Neukunden_Akquise_Produkte", TimeReport[Neukunden_Akquise_Produkte],
            "User Name", TimeReport[User Name]
        )
    RETURN
        COUNTROWS( _table3_from_your_code )
    

    This return number, and string all support.

     

    Fourth, for detail of differences between columns and measures 

    https://insightsoftware.com/blog/calculated-columns-vs-measures/ 

     

    Best Regards

    Community Support Team _ chenwu zhu

     

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