Forum Discussion

NilR's avatar
NilR
Post Patron
4 years ago
Solved

SelectColumns with distinct count not working

How to sum(count) considering duplicates in YYYYMM, so the total should be 9 not 11.

 

SELECTCOLUMNS(
FILTER('TABLE',([DATE]>= Min_Date && [DATE]<= Max_Date) &&  [CATEGORY]=_CAT && [COUNT] > 0 ),"CAT", [CATEGORY],"_ID",_ID], "DATE", [YYYYMM],"_CTC",COUNTROWS(DISTINCT('TABLE'[YYYYMM]))
)

 

 

  • Hi,

    Drag Measure 2 to a card visual

    Measure 1 = min(Data[Count])

    Measure 2 = SUMX(values(Data[YYYYMM]),[Measure 1])

    Hope this helps.

4 Replies

  • Hi,

    Drag Measure 2 to a card visual

    Measure 1 = min(Data[Count])

    Measure 2 = SUMX(values(Data[YYYYMM]),[Measure 1])

    Hope this helps.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        The entries the Count columns are probably "numbers stored as text".  In the Query Editor, change the data type of that column to Decimal numbers.