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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Conditional formatting help - Duplicate rows for ID

Hi All, 

 

I was wondering if someone could help me. I am having trouble with conditional formatting in Power BI and I need some assistance. My aim is so insert another column inside of the table to the right of the 'Time' column called [Example column] and this will show for example from the data below . 

 

if Time = 60 Then show 1 

if Time = 30 then show 0.5

if Time = 0 Then show 0

 

This is what my data looks like before I used the conditional formatting option in power query

PBIStudy123_2-1639506447816.png

When I try to do this in conditional formatting, it is finding all of the times associated to the ID number instead of the total value of 60. 

PBIStudy123_1-1639506396690.png

Is there a way I can limit this so it will only do the calculation on the whole number that the ID ticket totals to or is this not possible. 

 

thanks 

 

1 ACCEPTED SOLUTION
samdthompson
Memorable Member
Memorable Member

You need to return Time as a measure. Currently thats just the rows from a table. Youll need two measures:

 

Hours=SUM(Table1[Time])

 

Then the conditional measure

 

Example=SWITCH(TRUE(),[Time]=60,1,[Time]=30,0.5,0)

 

 

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @samdthompson , thank you for the logic. 

I have an issue with this though I am unable to use the EXAMPLE measure on more then 2 occasions before it freaks out. 

The larget number in the HOURS2 column is 2370 but using what you provided to me I am unable to make it work with more values. 

 

I would like to show 0 for all values that are 15 mins or less. 

I would like to show 0.5 for all values that are >=16 but less than <=45 

I would like to show 1 for all values that are >=46 but less than <=75

 

Example1 = SWITCH(TRUE(),[Hours2] <= 45,0.5 ,[Hours2] >= 16,0.5,[Hours2] <= 15,0)

 

The result I get is this - 

 

PBIStudy123_0-1640107578766.png

 

but when I use only 2 values I get this - Which is working

PBIStudy123_1-1640107846854.png

 

Can you show me how I would write more then 2 values please

 

thanks 

 

samdthompson
Memorable Member
Memorable Member

You need to return Time as a measure. Currently thats just the rows from a table. Youll need two measures:

 

Hours=SUM(Table1[Time])

 

Then the conditional measure

 

Example=SWITCH(TRUE(),[Time]=60,1,[Time]=30,0.5,0)

 

 

// if this is a solution please mark as such. Kudos always appreciated.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors