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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

need help on cumulative values / multiple formulas

Hi Experts,

Need help on below data.

I need to write below formulas. Tried all ways, but not able to achieve.

 

Formula1: ((X2020/ Y2020) * Y2021) - X2021

                        Result: 

 $    1,193 $           230 $        381 $    1,291 $        167 $      (368) $      (730) $  (1,278) $      (696) $  (2,374) $      (944) $      (250)

 

Formula2: (((JanX2020:febX2020)/ (JanY2020:FebY2020)) * (JanY2021:FebY2021)) - (JanX2021:FebX2021) - continue till Dec

Result:

$1,193 $        1,383 $    1,646 $    2,902 $    3,064 $    2,583 $    1,759 $        382 $      (418) $  (2,864) $  (3,805) $  (4,057)

 

Formula3: (currenth month - preious month)

JanFeb-JanMar-FebApr-MarMay-AprJune-MayJuly-JuneAug-JulySep-AugOct-Sep

 Result:

$1,193 $           190 $        263 $    1,256 $        162 $      (481) $      (824) $  (1,377) $      (800) $  (2,446) $      (941) $      (252)

 

 

Final Outpt: (Formula3 / 1000) -  (showing single decimal)

 

Output            
 JanFebMarAprMayJunJulAugSepOctNovDec
(1.2)(0.2)(0.3)(1.3)(0.2)0.50.81.40.82.40.90.3
B0.0(0.2)(0.1)(0.6)(0.3)(0.6)(0.1)0.20.30.1(0.0)0.1

 

Data / Input to power BI flle

 

DivisonyearMonthXY
A2021Jan $       6,921 $  149,996
A2021Feb $       6,497 $  138,298
A2021Mar $       7,013 $  172,812
A2021Apr $       7,212 $  164,285
A2021May $       7,107 $  155,571
A2021Jun $       7,164 $  159,607
A2021Jul $       7,370 $  155,221
A2021Aug $       7,758 $  154,091
A2021Sep $       7,358 $  165,038
A2021Oct $       7,667 $  161,951
A2021Nov $       7,483 $  161,677
A2021Dec $       7,324 $  155,816
A2020Jan $       6,750 $  124,775
A2020Feb $       6,184 $  127,142
A2020Mar $       7,333 $  171,376
A2020Apr $       7,235 $  139,798
A2020May $       6,681 $  142,892
A2020Jun $       7,059 $  165,789
A2020Jul $       7,128 $  166,637
A2020Aug $       7,157 $  170,188
A2020Sep $       7,278 $  180,292
A2020Oct $       5,401 $  165,253
A2020Nov $       6,411 $  158,513
A2020Dec $       6,921 $  152,446
B2021Jan $           731 $    42,000
B2021Feb $           518 $    33,003
B2021Mar $           681 $    37,679
B2021Apr $           614 $    44,388
B2021May $           570 $    32,053
B2021Jun $           679 $    42,603
B2021Jul $           669 $    48,138
B2021Aug $           694 $    38,014
B2021Sep $           720 $    44,967
B2021Oct $           691 $    44,137
B2021Nov $           694 $    37,750
B2021Dec $           800 $    49,233
B2020Jan $           647 $    37,759
B2020Feb $           606 $    27,740
B2020Mar $           638 $    29,651
B2020Apr $           719 $    22,099
B2020May $           642 $    23,988
B2020Jun $           862 $    29,397
B2020Jul $           723 $    43,316
B2020Aug $           659 $    40,381
B2020Sep $           885 $    64,839
B2020Oct $           776 $    50,503
B2020Nov $           706 $    37,855
B2020Dec $           711 $    48,953
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , with help from date table and time intelligence you can have YOY like

 

examples

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

 

MOM

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , with help from date table and time intelligence you can have YOY like

 

examples

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

 

MOM

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak 

Thank you so much for your time and solution.

 

Humble request from my side, as I am new beginner and little confused on dates part / YTD / MTD, is it possible for you to help me by creating a  sample PBI file using my above data and send me here.

 

I know this is not the right thing to ask, but I am still not able to find a solution for my query.

 

Thanks again.

 

Thanks,

Raj

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors