cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

Calculated column HELP!

Hi All,

I'm trying to create a calculated column based on some specific criteria.

So i have a list of LCV registration numbers and i want to identify which ones still have an mot. So the column should be: vehicles[vehicle_has_MOT). I want to see "1" when the vehicle has the MOT product, and "0" when it doesn't.

MOT is a parent product in the same table, and has the three sub products in a separate column:

Reg        Product        Product Type        Policy Count (we use 1 or 0)  CALC_COLUMN

ABC        MOT            Single Payment     1

ABC        MOT            Monthly Payment  0

ABC        MOT            FOC                       0

I want the CALC_COLUMN to do something like vehicles_[has_MOT]=1

apologies if this is obvious, i'm new to Power BI 🙂

1 ACCEPTED SOLUTION
Solution Sage

Hi @James__

Can you please try this DAX for calculated column

CAL_COLUMN =
SWITCH(
TRUE(),
'Table (2)'[Product]="MOT" && 'Table (2)'[Product Type]="Single Payment", 1,
0)

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos
6 REPLIES 6
Resolver I
`CALC_COLUMN = IF( Product = "MOT", 1, 0 )`

Paste it in the new column.

Accept it as a solution if its help you to solve your problem.

Solution Sage

@James__

Reg        Product        Product Type        Policy Count (we use 1 or 0)  CALC_COLUMN

ABC        MOT            Single Payment     1

ABC        MOT            Monthly Payment  0

ABC        MOT            FOC                       0

2nd and 3rd line has product MOT, but why you are showing 0 inplace of 1

Frequent Visitor

Hello @PijushRoy

The MOT has 3 separate products: Single payment, monthly payment and FOC. In the example above, this particular van has a single payment MOT product, and not monthly payment or FOC.

Hope that helps.

J

Solution Sage

Hi @James__

Can you please try this DAX for calculated column

CAL_COLUMN =
SWITCH(
TRUE(),
'Table (2)'[Product]="MOT" && 'Table (2)'[Product Type]="Single Payment", 1,
0)

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos
Frequent Visitor

Sorry, that didn't work 🤔

Solution Sage

Hi there!

You can try this:

IF( Product = "MOT", 1, 0 )

Let me know if that helps!

Announcements

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors