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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Oros
Post Prodigy
Post Prodigy

If statements

Hello.

 

Does this issue need a conditional measure? Any idea is highly appreciated.  Thanks.

 

I have the following product table and customer table.

Oros_0-1663545089545.png

 

For some reasons, the price that appears in the results table is always based on the pricing level (#4)

Oros_1-1663545160061.png

 

Based on customer XYZ's pricing level (#2), the correct table result should be

Oros_2-1663545243462.png

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi @Oros ,

according to the sample table, I am able to get the correct table. 

Chew_WenJie_0-1663554799787.png
Do the same customer have different pricing level?

View solution in original post

12 REPLIES 12
ryan_mayu
Super User
Super User

@Oros 

based on the sample data, i think you can just drag the columns to table to get the expected output

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Chew_WenJie
Resolver III
Resolver III

Hello, is there any relationship between the two table? if no, i think linking the pricing level between two table will solve the problem. Or, another way is create a measure 

CALCULATE(SUM('PRODUCT TABLE'[PRICE]),'CUSTOMER TABLE'[PRICING LEVEL]='PRODUCT TABLE'[PRICING LEVEL])

 

Hope able to solve the problem.

Hi @Chew_WenJie ,

 

Thank you for your quick reply.  The customer table is related to product table through PRICING LEVEL.  Somehow, the measure that you suggested cannot find the column 'PRODUCT TABLE' [PRICING LEVEL]).  DOes the PRICING LEVEL have to be a measure and NOT a column?  Thank you again.

 

Yes, it can be a column, you may refer to the dax below.

Pricing = CALCULATE(SUM('Product Table'[Price]),'Customer Table'[Pricing Level]=EARLIER('Product Table'[Pricing Level]))

 

Hope this can help you.

Hi @Chew_WenJie ,

 

Thank you again for your reply.  Here is the actual error.  Please note that Customer_Price_Group and Sales_Code are both equivalent to PRICING LEVEL in the example above.  CustomerPricing table is equivalent to PRODUCT table.

Oros_0-1663550735439.png

 

Oh I see, understood. I think for the error of code above you need to change to create new column instead of measure. 

Chew_WenJie_0-1663551297329.png

Below is the code for measure and column, you may choose which you want.

Create New Measure :

Measure = 
var pricinglevel = SELECTEDVALUE('Customer Table'[Pricing Level])
return
CALCULATE(SUM('Product Table'[Price]),'Product Table'[Pricing Level]=pricinglevel)

Create New Column : 

Pricing = CALCULATE(SUM('Product Table'[Price]),'Customer Table'[Pricing Level]=EARLIER('Product Table'[Pricing Level]))

 

Hope this can help you, you also can refer to the @ryan_mayu solution

 

Hi @Chew_WenJie ,

 

Thank you for your update.

 

When the (new) column is created, a customer shows 3 different pricing level instead of only 1 pricing level.  The price that should show should only be $48.00.

Oros_1-1663552751030.png

 

When the (new) measure s created, the resulting table became blank.

Oros_3-1663552871761.png

 

Oros_2-1663552853302.png

 

 

 

Hi @Oros ,

according to the sample table, I am able to get the correct table. 

Chew_WenJie_0-1663554799787.png
Do the same customer have different pricing level?

Hi @Chew_WenJie ,

 

Thank you so much!

hi @Chew_WenJie ,

 

Each customer only has one (1) pricing level.  Thanks.

Hi @Chew_WenJie ,

 

May I confirm the relationship between your tables?  For some reasons, the calculated column (PRICE) shows 3 pricing levels.  The only correct equivalent price is $12.00 for this pricing level. Maybe I am missing something here. Thanks.

Oros_0-1663814001144.png

 

Hi @Oros ,

Here is my relationship between the table.

Chew_WenJie_1-1663817497941.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors