Forum Discussion

ncbshiva's avatar
ncbshiva
Icon for Advocate V rankAdvocate V
6 years ago
Solved

Cumulative Count with Date Slicer

Hi All,

 

I have a Cumulative Count with a Date Slicer in a Table Visual. I have a date table which is linked to my FACT table by Date.

 

In the above screenshot , my first column is Cumulative Count.

If i change the date slicer the Cumulative Count becomes zero. I want the Cumulative Count to show based on the dates selected from the Date Slicer.

 

DAX for Cumulative Count = CALCULATE(
CALCULATE(COUNTROWS(DISTINCT(FACT_LogIn_Data[ID]));
FILTER(
ALLSELECTED('Date'[Date]);
ISONORAFTER('Date'[Date]; MAX('Date'[Date]); DESC)
)
) )

 

Not sure i should change the DAX for Cumulative measure or something. Please help me with this.

  • Anonymous's avatar
    Anonymous
    6 years ago

    hi ncbshiva ,

     

    Here's the test data I used:

    Table “fact”

    Table “date”

    Please check following steps as below:

    1. Delete relationship if there is any relationship between table “date” and table “fact”.
    2. Create measure:

              Measure =

              CALCULATE (

                  COUNT ( 'fact'[id] ),

                  FILTER ( ALLSELECTED ( 'fact' ), 'fact'[date] <= MAX ( 'fact'[date] ) )

              )

              Measure 3 =

              VAR sv =

                  SELECTEDVALUE ( 'date'[date], BLANK () )

              RETURN

                  IF ( MAX ( 'fact'[date] ) > sv, BLANK (), [Measure] )

    1. Results would be shown as below:

    Pbix as attached, hopefully works for you.

     

    Community Support Team _ Jay Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    hi ncbshiva ,

     

    Here's the test data I used:

    Table “fact”

    Table “date”

    Please check following steps as below:

    1. Delete relationship if there is any relationship between table “date” and table “fact”.
    2. Create measure:

              Measure =

              CALCULATE (

                  COUNT ( 'fact'[id] ),

                  FILTER ( ALLSELECTED ( 'fact' ), 'fact'[date] <= MAX ( 'fact'[date] ) )

              )

              Measure 3 =

              VAR sv =

                  SELECTEDVALUE ( 'date'[date], BLANK () )

              RETURN

                  IF ( MAX ( 'fact'[date] ) > sv, BLANK (), [Measure] )

    1. Results would be shown as below:

    Pbix as attached, hopefully works for you.

     

    Community Support Team _ Jay Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.