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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
SalvaC
Frequent Visitor

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:

SalvaC_3-1739373733823.png

 

 

It works flawlessly in PBI Desktop:

SalvaC_1-1739373526432.png

 

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

SalvaC_2-1739373561142.png

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 3
SalvaC
Frequent Visitor

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 %

SalvaC_0-1739775267350.png

 

Here, the result in PBI Desktop:

SalvaC_1-1739775538147.png

 

And here, in the Service:

SalvaC_2-1739775572703.png

 

What is wrong with my approach?

 

Regards

Salvatore

v-zhengdxu-msft
Community Support
Community Support

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.

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

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors