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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
onkelphill
Frequent Visitor

Calculate Total Price | Lookup values

Hello everyone,

 

looking for help to solve with the following, probably standard, scenario.

 

I need to calculate the total price ( quantity * rate) for each transaction of the Lanes table. Ultimately i need  to compare prices to find the lowest bid. 

 

So, i was trying to define a measure to do the following:

 

For each supplier multiply quantity * rate giving the following conditions:

Lanes[Lane ID] = Quotations[LaneID]

Lanes[Bracket] = Quotations[Bracket]

 

I solved this problem in the past creating calculated columns to calculate prices for each and every supplier individually. 

 

The data model can be simplified as shown below:

 

Two tables:

Lanes (fact table)

Quotations

 

model.JPG

 

tables.JPG

 

6 REPLIES 6
v-chuncz-msft
Community Support
Community Support

@onkelphill,

 

You may consider using RANKX Function to add a calculated column first. 

Column =
RANKX (
    CALCULATETABLE (
        Quotations,
        ALLEXCEPT ( Quotations, Quotations[LaneID], Quotations[Bracket] )
    ),
    Quotations[Rate],
    ,
    ASC,
    DENSE
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft 

 

thank you very much.

 

Actually, i found this example and it is exactly what i am looking for. 

 

However, although i am following the instructions it does not work for me. This is the error message i am getting:

 

"A table of multiple values was supplied where a single value was expected"

 

Any ideas?

 

Thank you very much!

 

@onkelphill,

 

Take a good look at LOOKUPVALUE Function.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@onkelphill

 

This message says that you're using calculated column but should use measure instead.

@bsas

 

i know. Funny thing is, looking at the example i linked above it works.

Hi @onkelphill,

 

Have you resolved this problem?  If not, share the link from where i can download you file and also show your expected result there.


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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.