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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Juju123
Helper III
Helper III

Show cumul only in last month in graph

Good morning,

I have the following problem that I cannot resolve.
I have this type of chart.

Juju123_0-1726579703655.png

 

I want to display the cumulative value only for the last month.

For example, if I select the company B130, I want all the values ​​and display the cumulative total with a point for the month of September.

Juju123_2-1726579737959.png

 

Likewise, if I select company B220, I want to display the cumulative total with a point for the month of August.

Here is my DAX formula:

 

Cumul = IF(MONTH(SELECTEDVALUE('Entity (Feuil1)'[Date]))=MONTH(TODAY()) && YEAR(SELECTEDVALUE('Entity (Feuil1)'[Date]))=YEAR(TODAY()),
     Calculate (
         sum('Entity (Feuil1)'[Order]),
         FILTER(
            ALLSELECTED('Entity (Feuil1)'[Date]),
            ISONORAFTER('Entity (Feuil1)'[Date], MAX('Entity (Feuil1)'[Date]), DESC)
         )
),BLANK())

 

My data it this : 

 

EntityDateOrder
B13030/04/20201
B13012/05/20231
B13022/06/20233
B13012/12/20232
B13001/08/20242
B13014/09/20241
B22001/02/20231
B22004/07/20231
B22005/03/20241
B22011/08/20242
B22002/06/20241

Thank you in advance for your help

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@Juju123 Hi! Try with:

Cumul =
VAR LastMonthDate = CALCULATE(
MAX('Entity (Feuil1)'[Date]),
ALLEXCEPT('Entity (Feuil1)', 'Entity (Feuil1)'[Entity])
)
VAR LastMonth = MONTH(LastMonthDate)
VAR LastYear = YEAR(LastMonthDate)

RETURN
IF (
MONTH(SELECTEDVALUE('Entity (Feuil1)'[Date])) = LastMonth &&
YEAR(SELECTEDVALUE('Entity (Feuil1)'[Date])) = LastYear,
CALCULATE(
SUM('Entity (Feuil1)'[Order]),
FILTER(
ALLSELECTED('Entity (Feuil1)'[Date]),
'Entity (Feuil1)'[Date] <= LastMonthDate
)
),
BLANK()
)

 

BBF

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Juju123 ,


Did  @BeaBF  reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.

 

Best regards,

Adamk Kong

BeaBF
Super User
Super User

@Juju123 Hi! Try with:

Cumul =
VAR LastMonthDate = CALCULATE(
MAX('Entity (Feuil1)'[Date]),
ALLEXCEPT('Entity (Feuil1)', 'Entity (Feuil1)'[Entity])
)
VAR LastMonth = MONTH(LastMonthDate)
VAR LastYear = YEAR(LastMonthDate)

RETURN
IF (
MONTH(SELECTEDVALUE('Entity (Feuil1)'[Date])) = LastMonth &&
YEAR(SELECTEDVALUE('Entity (Feuil1)'[Date])) = LastYear,
CALCULATE(
SUM('Entity (Feuil1)'[Order]),
FILTER(
ALLSELECTED('Entity (Feuil1)'[Date]),
'Entity (Feuil1)'[Date] <= LastMonthDate
)
),
BLANK()
)

 

BBF

Hi @BeaBF , thanks you so much it's work fine !

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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