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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Harry1980
Helper I
Helper I

Check for different values in the same row

Hi,

 

I would like to create a  measure which is checking whether a row contains different values. Actually in my company we have several affiliated entities. And it might occur that 2 (or even more) affiliated entities buy from the same external supplier, but at different prices. Those materials where our group is paying different prices I would like to identify. The purpose of my measure will be to filter only for those materials where we see different purchase prices among our entities. Like in the table below. For Material "B" you can see that among the 4 different purchase organisation in my group we don't have same pricing. I.e. my measure should identify materialID "B" as an item with different purchase prices.

 

Since I am more or less a beginner in "PBI" I have no clue how to make it. Is there anybody with a suggestion how to get my measure established. Maybe worth to be mentioned: MaterialID, PurOrg and the Purchase price are all from the same table in our company data set.

 

Your suggestions are very much appreciated.

 

Br

 

Harry

Material IDPurOrg 1PurOrg 2PurOrg 3PurOrg 4Check for different purchase prices
A1 €1 €1 €1 €FALSE
B2 €3 €5 €2 €TRUE
C2 €2 €2 €2 €FALSE
1 ACCEPTED SOLUTION
Anonymous
Not applicable

The Answer is Here. 

Measure =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table (7)'[Price] ),
ALLEXCEPT ( 'Table (7)', 'Table (7)'[Material ID] )
)
RETURN
IF ( _count = 1, "FALSE", "TRUE" )

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

For Measure, you can use this

 

 

Check for different purchase prices =
IF (
    SELECTEDVALUE ( 'Table'[IDPurorg] ) = SELECTEDVALUE ( 'Table'[1Purorg] )
        && SELECTEDVALUE ( 'Table'[IDPurorg] ) = SELECTEDVALUE ( 'Table'[2Purorg] )
        && SELECTEDVALUE ( 'Table'[IDPurorg] ) = SELECTEDVALUE ( 'Table'[3Purorg] )
        && SELECTEDVALUE ( 'Table'[1Purorg] ) = SELECTEDVALUE ( 'Table'[2Purorg] )
        && SELECTEDVALUE ( 'Table'[1Purorg] ) = SELECTEDVALUE ( 'Table'[3Purorg] )
        && SELECTEDVALUE ( 'Table'[2Purorg] ) = SELECTEDVALUE ( 'Table'[3Purorg] ),
    "FALSE",
    "TRUE"
)

 

 

OutPut : - 
c ans 1.png

Hi Vairag99,  thank you  for your support. I think there is a misunderstanding due to showing my table as a pivot. I apologize.  For my measure I will need to use 3 fields from the same table ("PurchasePrice"). 

1) dimPurchasePrice[MaterialID]

2)dimPurchasePrice[PurOrg]

3)dimPurchasePrice[Price]

 

 

All the needed purchase org info are retrieved from only 1 field, namely dimPurchasePrice[PurOrg]. I.e. the field dimPurchasePrice[PurOrg] can have the following values. PurOrg 1, PurOrg2, PurOrg3 or PurOrg4 (like below)

 

Do you also have an idea to get it work with the layout below?

 

Many thanks in advance

 

Br

 

Harry

Material IDPurOrgPrice
APurOrg12
APurOrg22
APurOrg32
APurOrg42
BPurOrg12
BPurOrg23
BPurOrg35
BPurOrg42

Harry1980_0-1644926395377.png

I hope this layout is better and understandable

Anonymous
Not applicable

The Answer is Here. 

Measure =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table (7)'[Price] ),
ALLEXCEPT ( 'Table (7)', 'Table (7)'[Material ID] )
)
RETURN
IF ( _count = 1, "FALSE", "TRUE" )

@Anonymous , it is working as expected. Thank you very much. Your support is much appreciated

Samarth_18
Community Champion
Community Champion

Hi @Harry1980 ,

 

You can create a column like below :-

Column =
VAR PurOrg1 =
    TRIM ( LEFT ( [PurOrg 1], SEARCH ( " €", [PurOrg 1], 1, 0 ) ) )
VAR PurOrg2 =
    TRIM ( LEFT ( [PurOrg 2], SEARCH ( " €", [PurOrg 2], 1, 0 ) ) )
VAR PurOrg3 =
    TRIM ( LEFT ( [PurOrg 3], SEARCH ( " €", [PurOrg 3], 1, 0 ) ) )
VAR PurOrg4 =
    TRIM ( LEFT ( [PurOrg 4], SEARCH ( " €", [PurOrg 4], 1, 0 ) ) )
RETURN
    IF (
        PurOrg1 = PurOrg2
            && PurOrg1 = PurOrg3
            && PurOrg1 = PurOrg4,
        TRUE (),
        FALSE ()
    )

Output:-

Samarth_18_0-1644914743499.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.