cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Compare previous and new sales

I have Data Like,

 Fin year Bill Month Qty 2015-2016 April 223 2015-2016 May 308 2015-2016 June 602 2015-2016 July 726 2015-2016 August 527 2015-2016 September 536 2015-2016 October 289 2015-2016 November 406 2015-2016 December 672 2015-2016 January 575 2015-2016 February 784 2015-2016 March 213 2016-2017 April 233 2016-2017 May 193 2016-2017 June 562 2016-2017 July 517 2016-2017 August 531 2016-2017 September 353 2016-2017 October 227 2016-2017 November 249 2016-2017 December 629 2016-2017 January 599 2016-2017 February 600 2016-2017 March 243

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

2 ACCEPTED SOLUTIONS
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]

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

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.

6 REPLIES 6
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]

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

Sorry, One Error has detected...

Show MSG..

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

Community Support

@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.
Memorable Member

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.

Helper I

Hi,

Great Job....

Thanks

Memorable Member

Qiuyun Yu, are we in Desktop for this?

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors