Forum Discussion

SalvaC's avatar
SalvaC
Advocate III
1 year ago

New Card with Conditional Formatting on Fabric Direct query

Hi all

 

I have the following scenario:

I have a Semantic model in Fabric.

Power BI Desktop is connected to the model with Direct Query (NOT Live Connection).

Direct Query is because it's a client tenant outside of my organization.

 

I have added a Card (New) with a reference value (PY) and an associated Detail Measure to show the YoY in %.

 

I set up Conditional formatting for the Detail to show the value in red when it's negative and green when it's positive:

 

 

It works flawlessly in PBI Desktop:

 

But when I upload the report to Fabric, I get a error message which isn't very informative:

The card works, as soon as I remove the conditional formatting.

 

I set up conditional formatting for a column visual and it works without problems.

 

Any ideas about the cause?

 

Kind regards

Salvatore

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi SalvaC 

     

    I did some test, but undortunately I can not reproduce your issue, it works fine in my side.

    Given I have so little information at this time, I can't tell what's causing your problem.You can create a support ticket for free and a dedicated Microsoft engineer will come to solve the problem for you.

    It would be great if you continue to share in this issue to help others with similar problems after you know the root cause or solution.

    The link of Power BI Support:  https://powerbi.microsoft.com/en-us/support/

    For how to create a support ticket, please refer to How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn

    Thank you for your understanding.

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • SalvaC's avatar
      SalvaC
      Advocate III

      Thank you very much for your effort Xu

       

      I will continue looking into it in the next days and keep this place updated.

      I will talk with the client about the possibility of a support ticket.

       

      Kind regards

      Salvatore

  • SalvaC's avatar
    SalvaC
    Advocate III

    I've rebuilt the same scenario with a Semantic Model in Import mode from the ContosoRetailDW dataset, and I get the same error.

     

    Here, step by step, what I did:

    1. Created the Measures:
      1. Sum Online Sales = SUMX('Online Sales', ( 'Online Sales'[UnitPrice] * 'Online Sales'[SalesQuantity]) - 'Online Sales'[DiscountAmount] )
      2. Online Sales PY =
        CALCULATE([Sum Online Sales],
        SAMEPERIODLASTYEAR('Date'[Date])
        )
      3. Online Sales (YoY %) =
        VAR Actual = [Sum Online Sales]
        VAR PY = CALCULATE([Sum Online Sales]
                        ,SAMEPERIODLASTYEAR('Date'[Date])
                        ,ALL('Date')
                        )
        RETURN
               DIVIDE((Actual - PY), Actual)
        I formatted the third Measure as a Percentage
    2. I added the Measures to a New Card:
      1. Sum Online Sales as Data
      2. Online Sales PY as a Reference label
      3. Online Sales YoY % as Detail for the Reference label
    3. Lastly, I set up a conditional formatting rule for the reference label text based on the value of Online Sales YoY %

     

    Here, the result in PBI Desktop:

     

    And here, in the Service:

     

    What is wrong with my approach?

     

    Regards

    Salvatore