Forum Discussion
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_Akquise_Systeme", TimeReport[Neukunden_Akquise_Systeme],
"Neukunden_Akquise_Produkte", TimeReport[Neukunden_Akquise_Produkte],
"User Name", TimeReport[User Name]
)
)
When I add IF - it says: Multiple columns cannot be converted to a scalar value - what's wrong?
The idea is to render the complete table once the main condition is satisfying - please help.
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.
9 Replies
- AnonymousNot applicable
Instead of BLANK(), try using the DATATABLE() function in DAX to return a table with no records in it, but have the same field names and data types as the table returned by SELECTCOLUMNS().
- AnonymousNot applicable
Hi Sreenathv,
Unfortunately it is giving the same error message - any other thought ?
- AnonymousNot applicable
Is it a temporary table you are creating inside a measure? Otherwise, the calculated tables are generated during the data load/refresh. The "SELECTEDVALUE" and IF conditions are useful only when the user interacts with the report and you generate a measure using a temporary table in it. But once the table is generated during refresh/data load, whatever the user selects in a slicer or other visual, that's not gonna change the already calculated table. What is the scenario?