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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
mp390988
Helper V
Helper V

Using LookUpValue inside a measure

Hello,

I have this below:

mp390988_1-1754218105260.png

 

I want to add a column that shows the targets for each dealer group for each month.
I already created a summarised table as per below that groups the target by dealer and month.

 

mp390988_3-1754219547428.png

 

My model looks like this where the fields for my matrix are marked in yellow but I need to bring in the one marked in red.

mp390988_5-1754219835708.png

 

I can't create a relationship between my RevenueTargetsSummarised table and the CalendarTbl or with the TradesTbl because it results in a many-to-many relationship. Therefore, I created a measure as per below to retrieve the targets.

mp390988_6-1754220122752.png

 

However, when I drop this into the values section of my matrix visual I get an error:

mp390988_7-1754220236692.png



Is there something wrong in my formula?

 

Thank You in advance

 

 

1 ACCEPTED SOLUTION

At the total the SELECTEDVALUE call provides a blank value

 

probably the solution is

 

SUMX ( 
        SUMMARIZE ( 
                  RevenuesTargetsSummarised,
                  RevenueTargetsSummarised[DealerGroup],
                  CalendarTbl[Month]
        ),

          LOOKUPVALUE(
                 RevenueTargetsSummarised[MonthlyTargets],
                 RevenueTargetsSummarised[DealerGroup], SELECTEDVALUE(TradesTbl[DealerGroup]),
                 RevenueTargetsSummarised[Month], SELECTEDVALUE(CalendarTbl[Month])
          )

)

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

 

View solution in original post

8 REPLIES 8
v-achippa
Community Support
Community Support

Hi @mp390988,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @DataNinja777 , @FBergamaschi and @Ashish_Mathur for the prompt response.

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @mp390988,

 

We wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @mp390988,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

 

Thanks and regards,

Anjan Kumar Chippa

mp390988
Helper V
Helper V

So I managed to get my lookupvalue function working in my measure but my issue now is that I need to somehow display the sum in the yellow marked section.

 

mp390988_0-1754224556573.png

 

How can I acheive this in the measure definition.

At the total the SELECTEDVALUE call provides a blank value

 

probably the solution is

 

SUMX ( 
        SUMMARIZE ( 
                  RevenuesTargetsSummarised,
                  RevenueTargetsSummarised[DealerGroup],
                  CalendarTbl[Month]
        ),

          LOOKUPVALUE(
                 RevenueTargetsSummarised[MonthlyTargets],
                 RevenueTargetsSummarised[DealerGroup], SELECTEDVALUE(TradesTbl[DealerGroup]),
                 RevenueTargetsSummarised[Month], SELECTEDVALUE(CalendarTbl[Month])
          )

)

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

 

DataNinja777
Super User
Super User

Hi @mp390988 ,

 

Your visual is failing because of a data type mismatch in your LOOKUPVALUE formula. You are attempting to find a match by comparing the RevenueTargetsSummarised[Month] column, which is a date (e.g., 01/01/2025), with the result of MAX(CalendarTbl[MonthYear]), which is text (e.g., "Jan-25"). Since a date and a piece of text will never be equal, the formula cannot find a value and returns an error.

A quick way to fix this is to adjust your DAX measure to retrieve the correct date value from the visual's filter context. Instead of using MAX(CalendarTbl[MonthYear]), you can use MIN(CalendarTbl[Date]), assuming your calendar table has a Date column. This will fetch the first day of the month for the given row (e.g., 01/01/2025 for the "Jan-25" row), which can then be successfully matched to your targets table.

RevTrgtByDealerGrpMonthYear =
LOOKUPVALUE(
    RevenueTargetsSummarised[MonthlyTargets],
    RevenueTargetsSummarised[DealerGroup], SELECTEDVALUE(TradesTbl[DealerGroup]),
    RevenueTargetsSummarised[Month], MIN(CalendarTbl[Date]),
    0
)

However, the recommended and more robust solution is to improve your data model. Creating disconnected summary tables is often inefficient. You should delete the RevenueTargetsSummarised table entirely. Instead, use your original RevenueTargetsTbl and create a one-to-many relationship between your CalendarTbl[Date] column and your RevenueTargetsTbl[Month] column.

Once that relationship is established, you no longer need a complex LOOKUPVALUE function. You can create a much simpler and more efficient measure. This new measure will be automatically filtered correctly by the relationships in your model when you place it in the matrix visual. This approach is the standard best practice in Power BI.

Monthly Targets = SUM(RevenueTargetsTbl[Target])

 

Best regards,

 

Hi @DataNinja777 ,

Thank you for your response.

I prefer to follow your advice on removing the disconnected table because I want to keep my model clean. Therefore, as per your suggestion, I created a relationship between the original RevenueTargetsTbl and the CalendarTbl  and also created a measure called MonthlyTargets, all captured in the snapshot below:

mp390988_0-1754232870716.png

 

However, I noticed this measure is giving the total taregt irrespective of the dealer group.
For example, when DealerGroup = "Derivatives", the measure returns the following:

mp390988_1-1754233073209.png

 

When the actual values it should give should be the following:

mp390988_4-1754234213873.png

 

 

But when I change the dealer group to say "Phil", I also get the same values:

mp390988_2-1754233144878.png

Or if I change to "UAE" also get the same values:

mp390988_3-1754233241010.png

 

any idea of whats going on and how to fix please?

 

thank you

 






 

Hi,

Share the download link of the PBI file.


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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors