Forum Discussion

kaushik2020's avatar
kaushik2020
New Member
1 year ago
Solved

Card (New) Text color property

I am using a Card (new) in my sales dashboard. Currently i am using an expression to calculate the values. I wanted to know how i can set the text color to red and green based on the value. If the value is greated than  then Greeen else Red.

Sales_CYToPY =
VAR MaxDateValue = CALCULATE(MAX(MasterCalendar[Date]), ALL(MasterCalendar))
VAR CurrStartOfYear = DATE(YEAR(MaxDateValue), 1, 1)
VAR PrevStartOfYear = DATE(YEAR(MaxDateValue)-1, 1, 1)
VAR PrevEndOfYear = DATE(YEAR(MaxDateValue)-1, MONTH(MaxDateValue), DAY(MaxDateValue))

VAR CurrSales =
    CALCULATE(
        SUM(Orders_Details[Sales]),
        DATESBETWEEN(MasterCalendar[Date], CurrStartOfYear, MaxDateValue),
        ALL(MasterCalendar[Year], MasterCalendar[Month], MasterCalendar[Day])
    )

VAR PrevSales =
    CALCULATE(
        SUM(Orders_Details[Sales]),
        DATESBETWEEN(MasterCalendar[Date], PrevStartOfYear, PrevEndOfYear),
        ALL(MasterCalendar[Year], MasterCalendar[Month], MasterCalendar[Day])
    )

VAR GrowthRatio = DIVIDE(CurrSales, PrevSales, 0)
VAR GrowthPct = IF(GrowthRatio = 0, BLANK(), GrowthRatio - 1)

RETURN
IF(
    ISBLANK(GrowthPct),
    BLANK(),
    IF(
        GrowthPct >= 0,
        UNICHAR(9650) & " " & FORMAT(GrowthPct, "#,##0.0%"),
        UNICHAR(9660) & " " & FORMAT(GrowthPct, "#,##0.0%")
    )
)
  • Hi,

    On the formatting pane of the visual go to Callout values and there you can define a rule for coloring:

     

    Regards,

    Oktay

     

    Did it help? Please provide a KUDOS and mark the answer as solution

     

5 Replies

  • OktayPamuk80's avatar
    OktayPamuk80
    Icon for Responsive Resident rankResponsive Resident

    Hi,

    On the formatting pane of the visual go to Callout values and there you can define a rule for coloring:

     

    Regards,

    Oktay

     

    Did it help? Please provide a KUDOS and mark the answer as solution

     

    • kaushik2020's avatar
      kaushik2020
      New Member

      Hi OktayPamuk80  Yes Indeed. I was trying with an expression to achieve the same. but was wondering if there is an option same as Qlik Sense. Thanks again 🙂 

      • OktayPamuk80's avatar
        OktayPamuk80
        Icon for Responsive Resident rankResponsive Resident

        Hi, I worked a long time with Qlik Sense. However, there are features that you will miss in Power BI. Especially the conditional formatting options generally are same in Qlik Sense in each visual, this is not the case in Power BI. Additionally, conditional hide/show of visuals, columns, measures, etc. are not that easily to implement in Power BI.