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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

Last and Current Quarter

Hello,

I need to calculate the last quarter and current quarter for this year to be shown in CARD visual.   Quarter starts from April to March which will be fiscal year. Data has the value since last year May (2023) to till date. When I try to take the current quarter (April, May (2024)), its provides the data of just May month (38%) which is very worrying for me. Request your help on this.
For E:G, based on the data mentioned below my previous quarter should be(Jan to Mar) 39%
Current quarter should be(April-May) 34%.


Note: If its move to another quarter(July to Sep) it will have to pick the data automatically and show it.

I have the calendar table which I have created fiscal year, Quarter, Month Name, Month separately.

 

Store IdStore NameNewAdoptionTxnDt
1AA0%05-May-24
2BB80%05-May-24
3CC82%05-May-24
4DD56%05-May-24
5EE92%05-May-24
6FF0%05-May-24
7GG6%05-May-24
8HHH51%05-May-24
9AAA39%05-May-24
10BBB0%05-May-24
11AAA78%05-May-24
12AAAA28%05-May-24
13AAAAA16%05-May-24
14BBBBB2%05-May-24
1AA0%01-Apr-24
2BB80%01-Apr-24
3CC82%01-Apr-24
4DD56%01-Apr-24
5EE92%01-Apr-24
6FF0%08-Apr-24
7GG6%08-Apr-24
8HHH0%08-Apr-24
9AAA39%08-Apr-24
10BBB0%08-Apr-24
11AAA0%08-Apr-24
12AAAA28%15-Apr-24
13AAAAA16%15-Apr-24
14BBBBB14%15-Apr-24
1AA0%01-Jan-24
2BB80%08-Jan-24
3CC82%10-Jan-24
4DD56%21-Jan-24
5EE92%01-Feb-24
6FF0%08-Feb-24
7GG6%11-Feb-24
8HHH51%13-Feb-24
9AAA39%01-Mar-24
10BBB0%02-Mar-24
11AAA78%03-Mar-24
12AAAA28%04-Mar-24
13AAAAA16%05-Mar-24
14BBBBB14%06-Mar-24
1 ACCEPTED SOLUTION
v-jiewu-msft
Community Support
Community Support

Hi @Krishna_Newuser ,

First of all, many thanks to  for your very quick and effective replies.

Based on my testing, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1715824248379.png

2.Create the new measure to calculate current sales.

 

Current quarter = 
var quart_ = QUARTER(TODAY())
//SELECTEDVALUE('Table quarter'[Quart])
VAR current_rows = CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Quarter] = quart_))
VAR current_adop = CALCULATE(SUM('Table'[NewAdoption]), FILTER('Table', 'Table'[Quarter] = quart_))
var result = DIVIDE(current_adop, current_rows)
RETURN
FORMAT(result, "0%")
//result

 

3.Create the new measure to calculate forcast sales.

 

Lat quarter = 
var quart_ = QUARTER(TODAY())
//SELECTEDVALUE('Table quarter'[Quart])
VAR last_rows = CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Quarter] = (quart_ - 1)))
VAR last_adop = CALCULATE(SUM('Table'[NewAdoption]), FILTER('Table', 'Table'[Quarter] = (quart_ - 1)))
var result = DIVIDE(last_adop, last_rows)
RETURN
IF(quart_ = 1, BLANK(), FORMAT(result, "0%"))

 

4.Drag two measure into the card visual. The result is shown below.

vjiewumsft_1-1715824029970.png

Best Regards,

Wisdom Wu

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

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1715829351277.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-jiewu-msft
Community Support
Community Support

Hi @Krishna_Newuser ,

First of all, many thanks to  for your very quick and effective replies.

Based on my testing, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1715824248379.png

2.Create the new measure to calculate current sales.

 

Current quarter = 
var quart_ = QUARTER(TODAY())
//SELECTEDVALUE('Table quarter'[Quart])
VAR current_rows = CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Quarter] = quart_))
VAR current_adop = CALCULATE(SUM('Table'[NewAdoption]), FILTER('Table', 'Table'[Quarter] = quart_))
var result = DIVIDE(current_adop, current_rows)
RETURN
FORMAT(result, "0%")
//result

 

3.Create the new measure to calculate forcast sales.

 

Lat quarter = 
var quart_ = QUARTER(TODAY())
//SELECTEDVALUE('Table quarter'[Quart])
VAR last_rows = CALCULATE(COUNTROWS('Table'), FILTER('Table', 'Table'[Quarter] = (quart_ - 1)))
VAR last_adop = CALCULATE(SUM('Table'[NewAdoption]), FILTER('Table', 'Table'[Quarter] = (quart_ - 1)))
var result = DIVIDE(last_adop, last_rows)
RETURN
IF(quart_ = 1, BLANK(), FORMAT(result, "0%"))

 

4.Drag two measure into the card visual. The result is shown below.

vjiewumsft_1-1715824029970.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much, this helps

Bmejia
Solution Supplier
Solution Supplier

look at this post, I found it beside your post in the recommendations.  You will need to create a quarter column, then two measures for your current and previous quarter results.

https://community.fabric.microsoft.com/t5/Desktop/Current-Quarter-and-last-quarter-calculation/m-p/7...

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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