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
kasai16
Regular Visitor

Convert Tableau color formula to Power Bi

Hi,

 

I want below Tableau calculated field to be worked in power BI (Measure or Column) as i have to give the color basis on the value available in Power BI.

 

IF ZN([Calculation) = 0 THEN "No Qty in Scenario"
ELSEIF (ZN([Calculation]) - LOOKUP(ZN([Calculation]),FIRST())) = 0 THEN "Qty = Baseline"
ELSEIF (ZN([Calculation]) - LOOKUP(ZN([Calculation]),FIRST())) > 0 THEN "Qty > Baseline"
ELSEIF (ZN([Calculation]) - LOOKUP(ZN([Calculation]),FIRST())) < 0 THEN "Qty < baseline"

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@kasai16 , First create a measure for calculation


Calculation = SUM('YourTable'[YourColumn])

 

Then for Lookup value


BaselineValue =
CALCULATE(
[Calculation],
FIRSTNONBLANK('YourTable'[YourColumn], 1)
)

 

In the end final measure for conditional logic

dax
QtyStatus =
VAR CurrentCalculation = [Calculation]
VAR BaselineCalculation = [BaselineValue]
RETURN
IF(
ISBLANK(CurrentCalculation) || CurrentCalculation = 0,
"No Qty in Scenario",
IF(
CurrentCalculation - BaselineCalculation = 0,
"Qty = Baseline",
IF(
CurrentCalculation - BaselineCalculation > 0,
"Qty > Baseline",
"Qty < Baseline"
)
)
)

 

Now you can use QTY status in conditional formatting of visual

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@kasai16 , First create a measure for calculation


Calculation = SUM('YourTable'[YourColumn])

 

Then for Lookup value


BaselineValue =
CALCULATE(
[Calculation],
FIRSTNONBLANK('YourTable'[YourColumn], 1)
)

 

In the end final measure for conditional logic

dax
QtyStatus =
VAR CurrentCalculation = [Calculation]
VAR BaselineCalculation = [BaselineValue]
RETURN
IF(
ISBLANK(CurrentCalculation) || CurrentCalculation = 0,
"No Qty in Scenario",
IF(
CurrentCalculation - BaselineCalculation = 0,
"Qty = Baseline",
IF(
CurrentCalculation - BaselineCalculation > 0,
"Qty > Baseline",
"Qty < Baseline"
)
)
)

 

Now you can use QTY status in conditional formatting of visual

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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!

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.