Forum Discussion

lubosst's avatar
lubosst
Frequent Visitor
6 years ago
Solved

Dax query optimization - DISTINCTCOUNT with FILTER

Hi, I need some help. I want to speed up my report. While I was learning DAX, I made some terrible formulas, that I now trying to optimalise them. I have a table with several ID's for one order, on...
  • MartynRamsden's avatar
    MartynRamsden
    6 years ago

    Hi lubosst 

     

    Does this work for you?

     

    Number of Orders SUMX = 
    VAR MinDate = MIN ( Date_table[Date] )
    VAR MaxDate = MAX ( Date_table[Date] )
    VAR Result =
    CALCULATE (
        SUMX ( VALUES ( circuit[id2] ), 1 ),
        circuit[date1] <= MaxDate,
        circuit[date1] >= MinDate
    )
    RETURN Result

     

    Best regards,

    Martyn