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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
NicolPuglia
Frequent Visitor

Table formatting conditions

Hi,

 

I have a table widget and I would like the first 100 values to be colored according to the filter put.

 

With formatting conditions I can't.

 

Can you help me?

 

Thank you very much indeed!

 

Nicola

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @NicolPuglia ,

We can use the following steps to meet your requirement.

 

1. Create a measure to calculate the value of rows.

 

Measure = 
var x = MAX('Table'[date])
return
CALCULATE(DISTINCTCOUNT('Table'[date]),FILTER(ALLSELECTED('Table'),'Table'[date]<=x))

 

2. Then we can configure the Total measure’s conditional formatting using [Measure].

 

formatting 1.jpg

 

formatting 2.jpg

 

formatting 3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

View solution in original post

3 REPLIES 3
v-zhenbw-msft
Community Support
Community Support

Hi @NicolPuglia ,

We can use the following steps to meet your requirement.

 

1. Create a measure to calculate the value of rows.

 

Measure = 
var x = MAX('Table'[date])
return
CALCULATE(DISTINCTCOUNT('Table'[date]),FILTER(ALLSELECTED('Table'),'Table'[date]<=x))

 

2. Then we can configure the Total measure’s conditional formatting using [Measure].

 

formatting 1.jpg

 

formatting 2.jpg

 

formatting 3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

amitchandak
Super User
Super User

@NicolPuglia , Not very clear. But create a color measure using the filter and use that in conditional formatting, after selecting field option

Color Date = if(FIRSTNONBLANK('Date'[date],TODAY()) <today(),"lightgreen","red")

 

Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
Color Year = if(FIRSTNONBLANK('Date'[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK('Date'[Year],2014)>2018,"red","yellow"))

Color = if(FIRSTNONBLANK('Date'[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170
,"lightgreen",if(FIRSTNONBLANK('Date'[Year],2014)>2018,"red","yellow"))

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi!

 

Very Thanks!

 

But i want to show in the table widget only 100 record and color them

 

Thanks

 

Nicola

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors