cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bstark1287
Helper II
Helper II

MINX and MAXX returning higher and lower volume not year

I am trying to get my measures to return the volume of sales for the highest selected year and lowest selected year. I got some measures working but not how I intended. Basically the MAX measure will return the higher value. So if 2021 had higher sales total than 2022 it will return the 2021 sales value. Similarly MIN returns the lower volume not the lower year. Any help is greatly appreciated!!!

 

EX: If 2023 and 2021 are selected I want the MAXX to return $7,223,556.01 and MINX to return $35,559,982.53

20192020202120222023
8,337,760.319,448,871.4235,559,982.5324,448,871.427,223,556.01

 

Invoiced RT ACT Material Cost max per Year =
MAXX(
    KEEPFILTERS(VALUES('Raw Order Data'[Invoice Created Date].[Year])),
    CALCULATE([Invoiced RT ACT Material Cost])
)


Invoiced RT ACT Material Cost min per Year =
MINX(
    KEEPFILTERS(VALUES('Raw Order Data'[Invoice Created Date].[Year])),
    CALCULATE([Invoiced RT ACT Material Cost])
)

@Ashish_Mathur I am hoping you can help as I saw you were able to solve a similar question. I hope I am not being presumptous in tagging you. 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a calculated column formula for Year.  To your slicer, drag Year from the Calendar Table.  Create a relationship (Many to One and Single) from the Invoice Created Date column to the Date column of the Calendar Table.  Write these measures

Max selected year = max(calendar[year])

Amount at max selected year = calculate([Invoiced RT ACT Material Cost],filter(values(Calendar[year]),Calendar[year]=[Max selected year]))

Hope this helps.


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a calculated column formula for Year.  To your slicer, drag Year from the Calendar Table.  Create a relationship (Many to One and Single) from the Invoice Created Date column to the Date column of the Calendar Table.  Write these measures

Max selected year = max(calendar[year])

Amount at max selected year = calculate([Invoiced RT ACT Material Cost],filter(values(Calendar[year]),Calendar[year]=[Max selected year]))

Hope this helps.


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

Thank you! This is exactly what I needed. 

You are welcome.


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

Helpful resources

Announcements
Exciting changes

Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.