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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Hollys83
Frequent Visitor

Increase of 5% or more based on min and max date

I need to find 

Number of families who have increased their average monthly household income by at least 5%

 

I was able to group by HHID and date but couldn't figure out how to find the minimum and maximum date with a sum of income then do the comparison.

 

Apologies if this is not enough info to describe my issue. 

 

This is my data. 

HHIDDateMonthly
112/20/20230
13/7/2024276
13/7/20242381
25/1/20230
25/1/20232798
310/2/20230
310/11/20230
35/5/20232292
310/2/20232299
310/11/20233867
48/23/20230
412/5/20230
41/19/20240
44/1/20240
44/7/2023441
511/1/202360
55/10/2023739
55/10/20231046
512/19/20231190
62/21/20230
62/21/2023914
62/21/2024914
77/31/20230
74/4/2023186
74/4/2023841
77/11/20231013
83/13/20230
84/5/2024149
83/13/2023841
1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Hollys83 ,

 

Thanks @PhilipTreacy  and @Ashish_Mathur  for the quick reply. I have some other thoughts to add:

(1)We can create measures.

Pre = 
var _min_date=CALCULATE(MIN('Table'[Date]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID])))
var _min_date_income=CALCULATE(SUM('Table'[Monthly]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID]) && [Date]=_min_date))
var _max_date=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID])))
var _max_date_income=CALCULATE(SUM('Table'[Monthly]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID]) && [Date]=_max_date))
RETURN DIVIDE(_max_date_income-_min_date_income,_min_date_income)
Count = CALCULATE(DISTINCTCOUNT('Table'[HHID]),FILTER(ALLSELECTED('Table'),[Pre]>=0.05))

Then the result is as follows.

vtangjiemsft_0-1721977407688.png

 

Best Regards,

Neeko Tang

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

7 REPLIES 7
v-tangjie-msft
Community Support
Community Support

Hi @Hollys83 ,

 

Thanks @PhilipTreacy  and @Ashish_Mathur  for the quick reply. I have some other thoughts to add:

(1)We can create measures.

Pre = 
var _min_date=CALCULATE(MIN('Table'[Date]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID])))
var _min_date_income=CALCULATE(SUM('Table'[Monthly]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID]) && [Date]=_min_date))
var _max_date=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID])))
var _max_date_income=CALCULATE(SUM('Table'[Monthly]),FILTER(ALLSELECTED('Table'),[HHID]=MAX('Table'[HHID]) && [Date]=_max_date))
RETURN DIVIDE(_max_date_income-_min_date_income,_min_date_income)
Count = CALCULATE(DISTINCTCOUNT('Table'[HHID]),FILTER(ALLSELECTED('Table'),[Pre]>=0.05))

Then the result is as follows.

vtangjiemsft_0-1721977407688.png

 

Best Regards,

Neeko Tang

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

Ashish_Mathur
Super User
Super User

Hi,

Based on the data that you have shared, clearly show the expected result with an explanation.


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

Hi,

Based on the data that you have shared, clearly show the expected result with an explanation.


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

Hi @Hollys83 

 

Download example PBIX file

 

I'm not sure how the dates relate to the problem.  Are you looking for an increase month to month, or from the earliest date to the latest date?

 

If it's the latter, you can create 2 measures to work out the lowest income and highest income per HHID

 

 

Min Income = MIN('Income'[Monthly])

 

 

 

Max Income = MAX('Income'[Monthly])

 

 

The increase for each HHID is thus

 

 

Income Increase = DIVIDE(([Max Income] - [Min Income]), [Min Income], 1)

 

 

NOTE, where the min income was 0, the result of this measure will be 1, otherwise you'll get a divide by 0.  This means in the table below, the increase in such cases is 100%

 

famincme.png

 

Regards

 

Phil

 

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hello and thank you for answering. Yes, I need to find if the income increased from the earliest date to the latest date. 

@Hollys83 

 

OK, so the solution I provided should work for you then?

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Rather than finding the max and min income, how do I find the income by max and min date?

Once I get the min and max date and the income associated with those, I could then divide the two income amounts from min and max date. 
The max income could come from the minimum date but I need to find if they had an overall increaseof 5% from beginning to end. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.