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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
srisiva55
Frequent Visitor

Business Requirement to calculate metric calculation for certain category row by row basis

Hi All, I had requirement that states if product name like 'Jacket %' Or Product name like 'Shirt%' then expected value =Product Cost/1000 Other wise keep value as it is for rest of product names. How to do this in Query Edictor by adding new calculated column. Please help.  So below Product Names especially for Jacket, Shirt appended with some other text so I need to choose Like operation only  for example : Product Name LIKE 'Jacket%' etc..

 

 

 

Requirement.jpg

 

1 ACCEPTED SOLUTION
MS_Sum
Frequent Visitor

Hi @srisiva55 

1. Add a Calculated Column and use the formula mentioned below and see if it works. Change the column values as per your table

Expected Value =
IF(
    OR(
           LEFT([Prod Name], 6) = "Jacket",
        LEFT([Prod Name], 5) = "Shirt"
    ),
    DIVIDE([Prod Cost], 1000),
    [Prod Cost]
)
MS_Sum_0-1682148813929.png

If the suggestion helps, give a kudo and mark my reply as a solution  🙂

View solution in original post

1 REPLY 1
MS_Sum
Frequent Visitor

Hi @srisiva55 

1. Add a Calculated Column and use the formula mentioned below and see if it works. Change the column values as per your table

Expected Value =
IF(
    OR(
           LEFT([Prod Name], 6) = "Jacket",
        LEFT([Prod Name], 5) = "Shirt"
    ),
    DIVIDE([Prod Cost], 1000),
    [Prod Cost]
)
MS_Sum_0-1682148813929.png

If the suggestion helps, give a kudo and mark my reply as a solution  🙂

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.