March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Good morning,
I have the following problem that I cannot resolve.
I have this type of chart.
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.
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 :
Entity | Date | Order |
B130 | 30/04/2020 | 1 |
B130 | 12/05/2023 | 1 |
B130 | 22/06/2023 | 3 |
B130 | 12/12/2023 | 2 |
B130 | 01/08/2024 | 2 |
B130 | 14/09/2024 | 1 |
B220 | 01/02/2023 | 1 |
B220 | 04/07/2023 | 1 |
B220 | 05/03/2024 | 1 |
B220 | 11/08/2024 | 2 |
B220 | 02/06/2024 | 1 |
Thank you in advance for your help
Solved! Go to Solution.
@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
@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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |