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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mrothschild
Continued Contributor
Continued Contributor

Retrieving first column of data from a Matrix

Hi,

I'm trying to get a difference of Years in a dynamic Matrix.

 

The output in the screenshot below comes from the following formula, and is not the intended result.

 

   CALCULATE(
    MINX(GROUPBY('Helivalues Transaction History','Helivalues Transaction History'[Sale Year]),'Helivalues Transaction History'[Sale Year]),
        FILTER(
            'Helivalues Transaction History',
            'Helivalues Transaction History'[Sale Year] = 
                MINX(GROUPBY('Helivalues Transaction History','Helivalues Transaction History'[Sale Year]),'Helivalues Transaction History'[Sale Year])
        )
    )

 

 

mrothschild_0-1627933828074.png

From the above, I'd want the values in the matrix, going from left to right to be:

 

0, 1, 2, 3, 4, 5, 7. . . . (note that the 6 is missing because the year 2014 has no data in it)

 

but in order to do that, I need to return, in this example "2008" to subtract.  But the above formula was intended to put 2008 in every cell, rather than the corresponding Column header.

 

Thanks in advance for any help!

 

 

 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@mrothschild change measure to this:

 

Starting Sales Year = 
CALCULATE ( 
    MIN ( 'Helivalues Transaction History'[Sale Year] ), 
    ALLSELECTED ( 'Helivalues Transaction History'[Sale Year] ) 
)

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@mrothschild change measure to this:

 

Starting Sales Year = 
CALCULATE ( 
    MIN ( 'Helivalues Transaction History'[Sale Year] ), 
    ALLSELECTED ( 'Helivalues Transaction History'[Sale Year] ) 
)

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mrothschild
Continued Contributor
Continued Contributor

Sorry @parry2k one more quick question related to this.  The same way I'm returning 2008, 2009, etc. as the constant earliest year based on the slicer with ALLSELECTED()

 

how am I able to retrieve a non-self-referential number associated with the same 2008, 2009, etc.  For example how can I get the earliest [zzAverage Unit Current Price. . . ] associated with a given row to consistently appear in the matrix?

 

Thanks!

parry2k
Super User
Super User

@mrothschild try this measure:

 

Starting Sales Year = 
CALCULATE ( 
    MIN ( 'Helivalues Transaction History'[Sale Year] ), 
    REMOVEFILTERS ( 'Helivalues Transaction History'[Sale Year] ) 
)

 

parry2k_0-1627935119150.png

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mrothschild
Continued Contributor
Continued Contributor

Thanks for that @parry2k ,

 

but when I slice the Sale Year, to, say 2010, I want the Starting Sale Year to return 2010 please.

parry2k
Super User
Super User

@mrothschild how raw data look like? You need to share that to get the expected solution.  Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mrothschild
Continued Contributor
Continued Contributor

Thanks @parry2k ,

 

usually I do, and just plain forgot to this time.

 

Here's a link to PBIX: https://drive.google.com/file/d/1j_4CrUj0fPh0xK6hnO7OZ-uIWkoP5Kdg/view?usp=sharing

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.