Forum Discussion

erhan_79's avatar
erhan_79
Post Prodigy
5 years ago
Solved

need measure help

Hi there;

 

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

For the below example , we are in November so the current month is November, in dates only two dates include the amount for the current month. So I need to capture the sum of the amount as totally "150" like a result.

 

But pls don't forget the main thing when you open the report, the system will compare the date of the opening report and find the amount of the current month and the sum of it. I mean, if today was one of the days of December and if I open today's report system should be care to sum of the table below December dates.

 

Hope it's clear, thanks in advance

 

 

 

 

  • Please try this expression in a measure.

     

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

     

    Regards,

    Pat

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Please try this expression in a measure.

     

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

     

    Regards,

    Pat

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  erhan_79 ,

     

    Here are the steps you can follow:

    1. Create a calculated column.

    Year_Month = YEAR('Table'[Date])&" "&MONTH('Table'[Date])

    2. Create a measure.

    classification_amount = CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Year_Month]))

    3. Result.

     

     

     

    You can downloaded PBIX file from here.

     

    Best Regards,

    Liu Yang

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