Home / T-SQL / DAX Set column to Zero based on Username()

DAX Set column to Zero based on Username()

I was looking for a formule to reset a column in my tabular model to zero based on the user who is logged in. This is quick workaround. In SSAS Tabular 2016, it’s impossible to hide columns. We are used to a dimensional model. We had to find a quick fix.

After trial and error, I found a formula. The trick is to check the user who is using the Tabular model. When the user is in my hard-coded list (check USERNAME() ), we do a * 1, otherwise we do a * 0.

DAX Formula:

Marge Reeel Totaal:=
SUMX(
DeclaratieRegel;
DeclaratieRegel[_Marge Reeel Totaal] *
SWITCH(
USERNAME();
“NL\00007892”; 1;
“NL\00007444”; 1;

0
)
)

Check Also

Calculate Age in SQL Server

In my daily work, I need to calculate and report the age of people very …

Geef een antwoord

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *