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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jmgobet
Frequent Visitor

Get bug with calculate measure

Here are my data:

Capture A7017.PNG

Here is my tentative

#qty cumul = CALCULATE(SUM('data a7017'[qty]),FILTER(ALLSELECTED('data a7017'[date]),'data a7017'[date] <= MAX ('data a7017'[date])))

 

Capture A7017 cumul.PNG

 

and

Capture A7017 cumul1.PNG

I am trying to cumulative sum over month / year ie:

Capture A7017 expected.PNG

 

So definitely my measure is not correct, someone to give me a help?

Best

JM

2 ACCEPTED SOLUTIONS

As a final post for that thread here is the correct measure

#qte cumul = CALCULATE(
    [#qte]
, FILTER (ALLSELECTED('Datekey'), 'Datekey'[Date] <= MAX ( 'Datekey'[Date] ))
)

View solution in original post

Icey
Community Support
Community Support

Hi @jmgobet ,

 

Glad to hear this problem has been solved. Please accept your reply as the solution. Your contribution is highly appreciated.

 

 

Best Regards,

Icey

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@jmgobet , In case of cumulative, always prefer to have Date table 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=max(Sales[Sales Date])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

i have done as suggested, it is ok for the sample but not for the database?!?

I have screencasted my screen in order to better explain/

Best

JM

As a final post for that thread here is the correct measure

#qte cumul = CALCULATE(
    [#qte]
, FILTER (ALLSELECTED('Datekey'), 'Datekey'[Date] <= MAX ( 'Datekey'[Date] ))
)
Icey
Community Support
Community Support

Hi @jmgobet ,

 

Glad to hear this problem has been solved. Please accept your reply as the solution. Your contribution is highly appreciated.

 

 

Best Regards,

Icey

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.