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
Jacobmiller23
Helper II
Helper II

Help with Measure

Hi all,

 

I am ccurrently working on a project in BI and am running into an issue. Basically I am trying to get a value in one table into another table based on a date and a vendor. I have been trying to use a lookupvalue function, but seem to be running into issues for some reason and keep getting an error that says "a table of multiple values was supplied where a single value was expected." Basically I have a table with every single date of 2024 and for every date there is 10 items that a price value gets entered into every day. I assumed I would be able to match the correct price by doing a lookupvalue with the name of the item and the date, but I am running into issues. 

 

Here is a picture of my price table to help visualize. 

Jacobmiller23_0-1733335350511.png

Also here is an image of my error.

Jacobmiller23_1-1733335399763.png

 

If anyone has any suggestions/solutions, please let me know.

 

Thanks!

1 ACCEPTED SOLUTION
v-zhengdxu-msft
Community Support
Community Support

Hi @Jacobmiller23 

 

Please try this:

Here I create a set of sample:

Table:

vzhengdxumsft_0-1733363519178.png

Tbale 2:

vzhengdxumsft_1-1733363530960.png

Then add a measure:

 

MEASURE =
VAR _currentDate =
    MAX ( 'Table 2'[Table_Date] )
VAR _currentItem =
    SELECTEDVALUE ( 'Table 2'[Table_Market Item] )
RETURN
    SUMX (
        FILTER (
            'Table',
            'Table'[Date] = _currentDate
                && 'Table'[Market Item] = _currentItem
        ),
        'Table'[Price]
    )

 

The result is as follow:

vzhengdxumsft_2-1733363773619.png

 

It's worth noting that there are no relationship between the 2 tables:

vzhengdxumsft_3-1733363856709.png

 

 

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-zhengdxu-msft
Community Support
Community Support

Hi @Jacobmiller23 

 

Please try this:

Here I create a set of sample:

Table:

vzhengdxumsft_0-1733363519178.png

Tbale 2:

vzhengdxumsft_1-1733363530960.png

Then add a measure:

 

MEASURE =
VAR _currentDate =
    MAX ( 'Table 2'[Table_Date] )
VAR _currentItem =
    SELECTEDVALUE ( 'Table 2'[Table_Market Item] )
RETURN
    SUMX (
        FILTER (
            'Table',
            'Table'[Date] = _currentDate
                && 'Table'[Market Item] = _currentItem
        ),
        'Table'[Price]
    )

 

The result is as follow:

vzhengdxumsft_2-1733363773619.png

 

It's worth noting that there are no relationship between the 2 tables:

vzhengdxumsft_3-1733363856709.png

 

 

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

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.