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
ROG
Responsive Resident
Responsive Resident

Dax measures help need

Hi all,

 

I posted a question here this morning but I didn't get the full solution, so I thought I would post here where I got stuck at. 

I want to add a new column saying 'Customer type change?' = "1" if the product is different bettween the columns (First_CustType and CurrentCustType) and "0" if they have the same product.

 

ROG_1-1659451886260.png

 

A super user friend adviced me using the below.

Column = IF([First_Product] = [CurrentProduct],0,1)

 

For the highlighted below, do they need to be a measure?  The columns from my table are just fields from different tables (Cust_ID and First_CustType come from the table ProductAcquisition, and CurrentCustType comes from the table CustomerType. I tried to create both measures so I can create the measure below but it's not working. Se below the error I get. 

ROG_2-1659452123938.png

ROG_4-1659452430413.png

 

 

How can I get this done? 

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ROG ,

Please try below options:

My test table:

ProductAcquisition:

vbinbinyumsft_0-1659935543795.png

CustomerType:

vbinbinyumsft_1-1659935555866.png

Model:

vbinbinyumsft_2-1659935571439.png

 

Try below DAX to add new column in table ProductAcquisition:

CurrentCustType_FromCT = RELATED(CustomerType[CurrentCustType])
Column = if([First_CustType]= [CurrentCustType_FromCT],1,0)

vbinbinyumsft_3-1659936041993.png

 

Best regards,

Community Support Team_ Binbin Yu

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

2 REPLIES 2
Anonymous
Not applicable

Hi @ROG ,

Please try below options:

My test table:

ProductAcquisition:

vbinbinyumsft_0-1659935543795.png

CustomerType:

vbinbinyumsft_1-1659935555866.png

Model:

vbinbinyumsft_2-1659935571439.png

 

Try below DAX to add new column in table ProductAcquisition:

CurrentCustType_FromCT = RELATED(CustomerType[CurrentCustType])
Column = if([First_CustType]= [CurrentCustType_FromCT],1,0)

vbinbinyumsft_3-1659936041993.png

 

Best regards,

Community Support Team_ Binbin Yu

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

Barthel
Solution Sage
Solution Sage

Hey,

 

In measures you cannot directly refer to columns, because there is no row context. Your matrix contains the columns, so based on the filter context per row there is only one value for the columns. We can retrieve this single value using the SELECTEDVALUE function. Use this code for your measure:

 

 

 

Measure =
INT (
    SELECTEDVALUE ( ProductAcquisition[First_Product] )
        = SELECTEDVALUE ( ProductAcquisition[Current_Product] )
)

 

 

 

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.