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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
PKGARG
Helper I
Helper I

Compare previous and new sales

I have Data Like,

Fin yearBill MonthQty
2015-2016April223
2015-2016May308
2015-2016June602
2015-2016July726
2015-2016August527
2015-2016September536
2015-2016October289
2015-2016November406
2015-2016December672
2015-2016January575
2015-2016February784
2015-2016March213
2016-2017April233
2016-2017May193
2016-2017June562
2016-2017July517
2016-2017August531
2016-2017September353
2016-2017October227
2016-2017November249
2016-2017December629
2016-2017January599
2016-2017February600
2016-2017March243

 

Now what i write in measure column to calculate monthwise growth.

2 ACCEPTED SOLUTIONS
v-qiuyu-msft
Community Support
Community Support

Hi @PKGARG,

 

You can create calculated columns like below:

 

MonthNum = SWITCH('Table1'[Bill Month],"January",1,"February",2,"March",3,"April",4,"May",5,"June",6,"July",7,"August",8,"September",9,"October",10,"November",11,"December",12)

 

Year = IF('Table1'[MonthNum]>=4 && 'Table1'[MonthNum]<=12,VALUE(LEFT('Table1'[Fin year],4)),VALUE(LEFT('Table1'[Fin year],4)+1))

 

Date = DATE('Table1'[Year],'Table1'[MonthNum],1)

 

PreMon = CALCULATE(SUM(Table1[Qty]),PARALLELPERIOD('Table1'[Date],-1,MONTH))

 

Diff = 'Table1'[Qty]-Table1[PreMon]

 

 

qqqq.PNG

 

Best Regards,
Qiuyun Yu

 

Community Support Team _ Qiuyun Yu
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

actually the intent of my input/question is that: this post is in Service but your advised solution involves a calculated column - which I think can only be done in Desktop.  I was trying to clarify this point.

www.CahabaData.com

View solution in original post

6 REPLIES 6
v-qiuyu-msft
Community Support
Community Support

Hi @PKGARG,

 

You can create calculated columns like below:

 

MonthNum = SWITCH('Table1'[Bill Month],"January",1,"February",2,"March",3,"April",4,"May",5,"June",6,"July",7,"August",8,"September",9,"October",10,"November",11,"December",12)

 

Year = IF('Table1'[MonthNum]>=4 && 'Table1'[MonthNum]<=12,VALUE(LEFT('Table1'[Fin year],4)),VALUE(LEFT('Table1'[Fin year],4)+1))

 

Date = DATE('Table1'[Year],'Table1'[MonthNum],1)

 

PreMon = CALCULATE(SUM(Table1[Qty]),PARALLELPERIOD('Table1'[Date],-1,MONTH))

 

Diff = 'Table1'[Qty]-Table1[PreMon]

 

 

qqqq.PNG

 

Best Regards,
Qiuyun Yu

 

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

Sorry, One Error has detected...

 

Show MSG..

 

A Circular dependency was detected: Table1[PreMon],Table1[Column],Table1[PreMon].

@CahabaData Yes, you can download attached .pbix file and open it in desktop.

 

@PKGARG The error should occur when you try to delete the date table named "Table" in attached .pbix file. As to calculate PreMon use the PARALLELPERIOD() function, the table "Table" is necessary. 

PreMon = CALCULATE(SUM(Table1[Qty]),PARALLELPERIOD('Table1'[Date],-1,MONTH))

 

Best Regards,
Qiuyun Yu

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

actually the intent of my input/question is that: this post is in Service but your advised solution involves a calculated column - which I think can only be done in Desktop.  I was trying to clarify this point.

www.CahabaData.com

Hi,

 

Great Job....

 

Thanks

Qiuyun Yu, are we in Desktop for this?

www.CahabaData.com

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors