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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors
Top Kudoed Authors