Forum Discussion
Render data based on IF true condition
- 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.
This is really a great explanation - as I am new to PowerBI & Dax - I learned something new today, thanks to Anonymous
I implemented the above and works fine, a question would be how to return multiple Measures?
For example, I have 2 measures - [Neukunden - Akquise Systeme] & [Neukunden - Akquise Produkte] - which hold the sum of its respective values.
Now, I would like to show those 2 measures in a Visual?
This works of course:
Neukunden (User) =
IF (USERPRINCIPALNAME() in VALUES(TimeReport[TopManagers]),
[Neukunden - Akquise Produkte],
BLANK())
I tried to keep the Measure in an array but it doesn't look good
IF (USERPRINCIPALNAME() in VALUES(TimeReport[TopManagers]),
{[Neukunden - Akquise Produkte],[Neukunden - Akquise Systeme]},
BLANK())
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.