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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
James__
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

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)
001.JPG
 
If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos



Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

6 REPLIES 6
bilalrana
Resolver I
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.

PijushRoy
Super User
Super User

@James__ 

In your example, 

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
Please confirm




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





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

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)
001.JPG
 
If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos



Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





James__
Frequent Visitor

Sorry, that didn't work 🤔

PabloDeheza
Solution Sage
Solution Sage

Hi there!

You can try this:

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

Let me know if that helps!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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