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
GKs
Frequent Visitor

Running Total Specific Year

I would like to be able to compare a specific year against another by means of its days, that is to say that in a month X from day 1 to 30 to be able to see the evolution of sales day by day in an accumulated way.

The table below is where I was able to get through the formulas described.

Cump Ac 2019 = CALCULATE([2019 Sell Out]), FILTER(ALLSELECTED(Table[Sell Out]),Table[Date] <= MAX(Table[Date])))
Cump Ac 2018 = CALCULATE([2018 Sell Out], FILTER(ALLSELECTED(Table[Sell Out]),Table[Date] <= MAX(Table[Date] )))
For 2019 it is working as expected, however for the 2018 part it continues to bring the values even when it no longer corresponds to 2018.Capture.JPG

 

Capture1.JPG

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Cump Ac 2018 = IF(ISBLANK([2019 Sell Out]),BLANK(),CALCULATE([2018 Sell Out], FILTER(ALLSELECTED(Table[Sell Out]),Table[Date] <= MAX(Table[Date] ))))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Cump Ac 2018 = IF(ISBLANK([2019 Sell Out]),BLANK(),CALCULATE([2018 Sell Out], FILTER(ALLSELECTED(Table[Sell Out]),Table[Date] <= MAX(Table[Date] ))))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

thank you very much for your help.
I think the problem may be in the blank is only taking the range within 2019.

Try this way however the same happens if I include the If with the ISBLANK and BLANK.

 

Cump Ac % 2018 =
VAR AC2018= CALCULATE(SUM(Table Sell out[Sell Out]), FILTER(ALLSELECTED(Table date),Table date[date] <= MAX(Table date[date])))
RETURN
CALCULATE( AC 2018,
SAMEPERIODLASTYEAR(Table date[date]),ALL(Table date))Capture12.JPG

 

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

HI @GKs ,

These blank parts mean they not have corresponded table records, I think you need a calendar table with whole dates. Then you can use calendar date as axis and looping table records based on the calendar date.

Understanding DAX Auto-Exist 

Cumulative Total 

Regards,

Xiaoxni Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.