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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AngelaMarie
Helper II
Helper II

Count If Measure For Last 3 Months Above Value

I have a table of data that is in the format below:

CategoryMonthValue 1Value 2% Value
AAug 20201010010%
ASep 20202510025%
AOct 20202010020%
ANov 20203010030%
B

Aug 2020

3010030%
BSep 20202510025%
BOct 20202010020%
BNov 202051005%

 

I need to calculate how many categories have  achieved a % value >= 20% for the last 3 consecutive months rolling. So in the example above for Nov the count should be 1 (category A) as the % value was >= 20% for the last 3 months rolling. 
I'm not sure what the best way is to achieve this? I was thinking if I ended up with something like below than I can just sum the 3rd column for each of the months so for Oct there is 1 category that ended up achieving >= 20% for previous 3 months and for November there is also 1 category that ended up achieving >=20% for previous 3 months. 

CategoryMonth>= 20% for last 3 months
AOct 20200
ANov 20201
BOct 20201
BNov 20200

 

But if anyone has any better ideas? The Month value is from a date calendar, so it not initially grouped by month. I need the % value grouped by month before summing them over the 3 months rolling. 

2 ACCEPTED SOLUTIONS

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

You may download my PBI file from here.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

17 REPLIES 17
AngelaMarie
Helper II
Helper II

Redoing the tables as they are a bit difficult to see in the last post

 

This is the first table

 

Category____Month____Value 1____Value 2____% Value__
AAug 20201010010%
ASep 20202510025%
AOct 20202010020%
ANov 20203010030%
BAug 20203010030%
BSep 20202510025%
BOct 20202010020%
BNov 202051005%

 

 

The Second table:

 

__Category____Month____>= 20% last 3 months__
AOct 20200
ANov 20201
BOct 20201
BNov 20200

@AngelaMarie 

Can you also post a expect outcome based on the sample you provided, I will go for a test.

 

Regards
Paul

I would like to be able to show the count of categories >20% for the 3 month rollingd. Something like below

 

Month

Jan 2020Feb 2020Mar 2020
Category Count > 20%243

 

So in the above example under January 2020, there were 2 categories that achieved >20% for Nov 2019, Dec, 2019 and Jan 2020

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

That's perfect. Exactly what I was after. Thanks so much!! 🙂

I'm having a problem with the data. I changed the % value so it was a measure instead called "New % Value" in the image below:

 

newValue.PNG

The New % Value is calculated as follows: 

New % Value = DIVIDE(SUM(Data[__Value 1__]),SUM(Data[__Value 2__]))
 
I then added some more values for 1st of July so the totals are as above. I modified the existing ">20%" measure to take account of the new % value measure and its called "New >= 20% last 3 months" below
New20.PNG
So as you can see for Category A its flagging September as having greater than 20% for the last 3 months but only two of the months were greater than 20%.
The modified measure is
[New >= 20% last 3 months__] = COUNTROWS(FILTER(SUMMARIZE(VALUES(Data[Category__]),Data[Category__],"ABCD",countrows(FILTER(CALCULATETABLE('Calendar',DATESBETWEEN('Calendar'[Date],edate(MIN('Calendar'[Date]),-2),max('Calendar'[Date]))),[New % Value]>=0.2))),[ABCD]=3)).
 
Any idea why this is not working?

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Here is the link to the file

Hi,

For July 2020, there are multiple entries of A.  So should the denominator of A for July 2020 be 500 or 100?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

500

Hi,

You may download my PBI file from here.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank You!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi please find link to report. 

I haven't added any formula's - just added another category and some more values. Unfortunately, the greater than 20% measure is not calculating correctly. See category C in the workbook for Jul, Aug, Sep.

Hi,

I am unable to solve it.  May be someone else can help you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for giving it a go. 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.