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
Olf_10
New Member

Realized cumulative calculation

Hello everybody,

Here I have a DAX function which calculate realized actions on the month :

DX-Réceptionné mensuel =
CALCULATE(
SUM('AERO - Achats'[Réalisé])/1000,
'Dim - Versions'[PQM - Année Mois] = MAX('Dim - Versions'[PQM - Année Mois])
)
 
PQM - Année Mois give me the Year-Month value :
Olf_10_1-1684230145874.png
The measure gives me the blue bars on the graph at the end.
I search now to calculate the cumulative sum of these realized actions over the months. Here is my measure :
CALCULATE(
SUM('AERO - Achats'[Réalisé])/1000,
ALLSELECTED('Dim - Versions'[PQM - Année Mois]),
'Dim - Versions'[PQM - Année Mois] <= MAX('Dim - Versions'[PQM - Année Mois])
)
It gives me the blue line on the graph
 
Olf_10_0-1684229949837.png

As you can see, it doesn't give the expected result. I tried different things but impossible to find the solution.

Can somebody can give me help to resolve this problem ?

 
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Olf_10 ,

Please update the formula of your measure for culmulative calculation as below and check if it can return the expected result...

Culmulative =
CALCULATE (
    SUM ( 'AERO - Achats'[Réalisé] ) / 1000,
    FILTER (
        ALLSELECTED ( 'Dim - Versions' ),
        'Dim - Versions'[PQM - Année Mois] <= MAX ( 'Dim - Versions'[PQM - Année Mois] )
    )
)

If the above one can't help you, please provide some raw data in your table 'AERO - Achats' with Text format and your expected result with backend logic and special examples? By the way, is there any relationship between these two tables? If yes, please provide the related info. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

 

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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This process/patern will work.

  1. Create a Calendar Table with calculated column formlas for Year, Month name and Month number.  Sort the Month name by the Month number.
  2. Create a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table
  3. To your visual, drag Year and Month from the Calendar Table
  4. Write these measures

Total = divide(SUM('AERO - Achats'[Réalisé]),1000)

Total YTD = calculate([Total],datesytd('Calendar'[date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yiruan-msft
Community Support
Community Support

Hi @Olf_10 ,

Please update the formula of your measure for culmulative calculation as below and check if it can return the expected result...

Culmulative =
CALCULATE (
    SUM ( 'AERO - Achats'[Réalisé] ) / 1000,
    FILTER (
        ALLSELECTED ( 'Dim - Versions' ),
        'Dim - Versions'[PQM - Année Mois] <= MAX ( 'Dim - Versions'[PQM - Année Mois] )
    )
)

If the above one can't help you, please provide some raw data in your table 'AERO - Achats' with Text format and your expected result with backend logic and special examples? By the way, is there any relationship between these two tables? If yes, please provide the related info. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

 

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

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.