Forum Discussion

erhan_79's avatar
erhan_79
Post Prodigy
5 years ago
Solved

need help formula

Hi there ;

 

i need your small help , i have a table as below i need to calculate with a measure  only sum of the current month amount.

for below sample , we are in November so current month is November , in dates only two dates includes amount for current month . So i need to catch form sum = "150" result .

 

but dont forget pls the main thing when i open the report  , system will compare the date of opening report and will find current month amount and ewill sum .I mean if today was one of the december's day and if i would open report today system must care the in below table December dates .

 

i hope it is clear , thanks in advance 

 

 

  • Here is a measure expression that shows one way to do this.  I assume you will use this in a card visual.

     

    Sum This Month =
    VAR thismonth =
        MONTH (
            TODAY ()
        )
    RETURN
        CALCULATE (
            SUM ( TableA[Amount] ),
            FILTER (
                ALLSELECTED ( TableA[Date] ),
                MONTH ( TableA[Month] ) = thismonth
            )
        )

     

    Regards,

    Pat

     

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Here is a measure expression that shows one way to do this.  I assume you will use this in a card visual.

     

    Sum This Month =
    VAR thismonth =
        MONTH (
            TODAY ()
        )
    RETURN
        CALCULATE (
            SUM ( TableA[Amount] ),
            FILTER (
                ALLSELECTED ( TableA[Date] ),
                MONTH ( TableA[Month] ) = thismonth
            )
        )

     

    Regards,

    Pat

     

    • erhan_79's avatar
      erhan_79
      Post Prodigy

      @mahoneypat thank you but , in my dable there is no month column, but in your formula seems "MONTH ( TableA [Month] ) " , i am working on a live connect so i can not create column about month

      • mahoneypat's avatar
        mahoneypat
        Microsoft Employee

        That was a typo.  It is not the Month but the Date column again.  No Month column required.

         

        Sum This Month =
        VAR thismonth =
            MONTH (
                TODAY ()
            )
        RETURN
            CALCULATE (
                SUM ( TableA[Amount] ),
                FILTER (
                    ALLSELECTED ( TableA[Date] ),
                    MONTH ( TableA[Date] ) = thismonth
                )
            )

         

        Regards,

        Pat