Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dax Expression

I have table with date wise data,i want to show the value based on month end.

If it have value in jan 31st and dosnot have value in feb 28 then i want to show same value in 28 feb.

Please help me to create dax expression

10 Replies

  • Hi Anonymous ,

     

    I think that this request might be better in the developer forum so I have moved it there.  Also, I think a bit more explanation is going to be needed as to what you are truly trying to do - what is the actual thing that you are trying to do, from a logic perspective?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi collinq ,

      Thanks for the response.

      Am trying to figure out sum of customer count in each month.

      Let say in 31 jan 2021 active customer count is  2000,then feb there is no customer addition and customer count in 28 feb is 2000.So here there is no change in count ,i will not get the data from source,because we pulling data that have a change.In this case there is no record for particular operator in Feb but i want show count in visual that is same as january.Again the if the march month also dont have any change,i want show same figure as in january.

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous 

        I think you want to create a measure to show rolling total by month.

        Here I build a sample.

        Build a date table by dax.

        Date =
        VAR _T =
            ADDCOLUMNS (
                CALENDAR ( DATE ( 2021, 01, 01 ), DATE ( 2021, 05, 31 ) ),
                "Year", YEAR ( [Date] ),
                "Month", MONTH ( [Date] )
            )
        VAR _T1 =
            ADDCOLUMNS (
                _T,
                "Last Date each Month",
                    MAXX (
                        FILTER ( _T, [Year] = EARLIER ( [Year] ) && [Month] = EARLIER ( [Month] ) ),
                        [Date]
                    )
            )
        RETURN
            _T1

        Measure:

        Rolling Total = SUMX(FILTER(ALL('Sample'),'Sample'[Date]<=MAX('Date'[Last Date each Month])),'Sample'[QTY])

        Result is as below.

         

        Best Regards,
        Rico Zhou

         

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