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
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
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.

Top Solution Authors
Top Kudoed Authors