March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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"
Solved! Go to Solution.
@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
Proud to be a 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
Proud to be a Super User! |
|
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
168 | |
116 | |
63 | |
57 | |
50 |