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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
RevDan123
Frequent Visitor

Return the column name based on the cell selected in matrix

Matrix image.PNG

I am creating a button to take me to different drill through pages based on the cell I have clicked on. Below is what I currently have and works for the row selected. What I am struggling with is getting it to work based on the column as well. If I select 907 in the screen shot I would want to go to page referrals last 12 months, if I selected 439 I would want to go to referrals ytd. Any tips would be greatly appreciated. 

Button Page Logic =
            SWITCH (
                TRUE(),
                SELECTEDVALUE('ReferralRows'[RowName]) = "Referrals","Referrals",
                SELECTEDVALUE('ReferralRows'[RowName]) = "Pipeline","Pipeline",
                SELECTEDVALUE('ReferralRows'[RowName]) = "On Risk/Sales Completed","Completed",
                SELECTEDVALUE('ReferralRows'[RowName]) = "Not Taken Up","Not Taken Up",
                SELECTEDVALUE('ReferralRows'[RowName]) = "Factfinds Completed","FactFinds",
                SELECTEDVALUE('ADF DimReferralAgentType'[ReferralAgentTypeName]) = "Repeat User","Referrers",
                SELECTEDVALUE('ADF DimReferralAgentType'[ReferralAgentTypeName]) = "First Time Referral","Referrers",
                SELECTEDVALUE('ADF DimReferralAgentType'[ReferralAgentTypeName]) = "Reactivated","Referrers",
                SELECTEDVALUE('ADF DimReferralAgentType'[ReferralAgentTypeName]) = "Deactivated","Referrers"
                )
1 ACCEPTED SOLUTION

@RevDan123 So you can create a single measure that figures out which measure to display. For example:

Measure =
  VAR __Row = MAX('Table'[Row])
  VAR __Column = MAX('Table 2'[Column])
  VAR __Result = 
    SWITCH( TRUE(),
      __Row = "Referral" && __Column = "Current Month", [CM Referral Measure],
      __Row = "Referral" && __Column = "YTD", [YTD Referral Measure],
      __Row = "Pipeline" && __Column = "Current Month", [CM Pipeline Measure],
      __Row = "Pipeline" && __Column = "YTD", [YTD Pipeline Measure]
    )
RETURN
  __Result

I really don't have enough information to be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
RevDan123
Frequent Visitor

@Greg_Deckler Thats smart, far better than the solution I implemented. Thanks.

Greg_Deckler
Super User
Super User

@RevDan123 Not sure you can get there if those are measures. If you used a disconnected table for the column names and a single selection measure then I think you could use the same technique.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Yeah they are measures. Sorry what do you mean by single selection measure?

Do you have any tips on resolving the same issue, but in the below case the column headers are based on the date table?
Matix Date image.PNG

@RevDan123 So you can create a single measure that figures out which measure to display. For example:

Measure =
  VAR __Row = MAX('Table'[Row])
  VAR __Column = MAX('Table 2'[Column])
  VAR __Result = 
    SWITCH( TRUE(),
      __Row = "Referral" && __Column = "Current Month", [CM Referral Measure],
      __Row = "Referral" && __Column = "YTD", [YTD Referral Measure],
      __Row = "Pipeline" && __Column = "Current Month", [CM Pipeline Measure],
      __Row = "Pipeline" && __Column = "YTD", [YTD Pipeline Measure]
    )
RETURN
  __Result

I really don't have enough information to be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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