Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Count distinct values ​​without considering a table filter.

Hi all,

 

I have this table below,

 

 

Dataset

 

let
Fonte = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDXNzLUNzIwMlDSUXIsTS8tLlGK1YGIG+EQN8YhboJD3BSHuBk2cQt9Q0vs4kYGOMTh7g9OLShJzU1KLYJLGeGWMsYhZalvaIFbyhKnFMJ5SFKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, #"Accounting Month" = _t]),
#"Tipo Alterado com Localidade" = Table.TransformColumnTypes(Fonte, {{"Date", type date}}, "chr-Cher-US")
in
#"Tipo Alterado com Localidade"

 


I would like to know if there is a Dax function that is used to count the distinct values ​​of the Column “Accounting Month”, disregarding the Accounting Month of the table.

 

Filtered Date between 07/21 to 08/20

Index Ok

 

Filtered Date between 07/21 to 09/03
Index Error
Index would be 2 for all rows
 

 

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the suggestions Greg_Deckler 


      I tried to use both functions and the result was the same.

       

      Index = CALCULATE(DISTINCTCOUNT('Tabela (3)'[Accounting Month]), REMOVEFILTERS('Tabela (3)'[Accounting Month]))

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Anonymous Maybe: 

        Index = CALCULATE(DISTINCTCOUNT('Tabela (3)'[Accounting Month]), ALL('Tabela (3)'[Accounting Month]))