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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Memorable Member
Memorable Member

@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
v-kongfanf-msft
Community Support
Community Support

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
Memorable Member
Memorable Member

@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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.