Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I need to count distinct values for each day in a period, but when I choose the period of interest, the DAX function DISTINCTCOUNT only works for the entire period. Example:
In this case, I want to return the sum of the values, but if the column Date is removed, the function apply to the entire period, returning a undesirable result:
I am using the following formula:
Vendedoras*dias = CALCULATE(DISTINCTCOUNT(Tabela_Consulta_de_250_gestao[Nome]),REMOVEFILTERS(Tabela_Consulta_de_250_gestao[Nome]))
Obs.: I am using the REMOVEFILTERS function because it is a tooltip, and I want to compare filtered results with unfiltered, so I believe that part is not revelant.
Excuse me for my English, but the forum is very poor on my language.
Thank you in advance.
Solved! Go to Solution.
@muriloczs , Try like
Vendedoras*dias = Sumx(Values(Tabela_Consulta_de_250_gestao[Date] ) , CALCULATE(DISTINCTCOUNT(Tabela_Consulta_de_250_gestao[Nome]),REMOVEFILTERS(Tabela_Consulta_de_250_gestao[Nome])))
@muriloczs , Try like
Vendedoras*dias = Sumx(Values(Tabela_Consulta_de_250_gestao[Date] ) , CALCULATE(DISTINCTCOUNT(Tabela_Consulta_de_250_gestao[Nome]),REMOVEFILTERS(Tabela_Consulta_de_250_gestao[Nome])))
Worked for me, thank you!
User | Count |
---|---|
85 | |
77 | |
68 | |
49 | |
41 |
User | Count |
---|---|
111 | |
56 | |
50 | |
42 | |
40 |