Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
erhan_79
Post Prodigy
Post Prodigy

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 

 

caps1.JPG

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@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

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.