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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mussaka
Helper I
Helper I

Conditional formatting

Hi.

I should create a measure in DAX that simultaneously returns:

 

- if x < 0 then "over threshold"

- if x < 100 "close threshold"

- if x > 100 "within the threshold"

- if x < 50 (but only for CERTAIN people, for example "NY") "close threshold"

 

Where x is a measure that contains a "delta"

 

Did anyone understand me?

Thank you

 

 

1 ACCEPTED SOLUTION

Refer the file shared by @v-rongtiep-msft  and make required changes as shown in the below images to obtain the results.
VishalJhaveri_0-1676360099034.pngVishalJhaveri_1-1676360244106.png

VishalJhaveri_2-1676360442457.png

 


Thank you. 
If my answers helps you please mark it as solution.

 

View solution in original post

12 REPLIES 12
v-rongtiep-msft
Community Support
Community Support

Hi @Mussaka ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

result = IF([valuemeasure]<0,"over threshodl",IF([valuemeasure]>0&&[valuemeasure]<100,"close threshold",IF([valuemeasure]<50&&MAX('Table'[country])="english","close threshold",BLANK())))

vpollymsft_0-1675911555518.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

I have to create a slicer with 3 boxes: "over threshold", close threshold", "within the threshold" and I have 4  categories of people, "Chinese", "English" “italian”, “Spanish”. In the first box there must be all the people (Chinese, English, Italian e Spanish ) which have a negative number as a result of a measure (which is a delta). In the second box: if "Chinese" from 0 to 50 (this because their threshold is 100), if other countries from 0 to 100 (the threshold is 200); in the third box all the other possibilities except those just described.

If correct, the slicer will return in a table only the names of the people in the 3 categories I mentioned above. I hope I have been clear enough.

Thanks in any case for the help you will know give me.

Best regards

Hi @Mussaka ,

Could you please provide some sample data and your desired output with more details?

 

How to Get Your Question Answered Quickly 

 

Best Regards
Community Support Team _ Polly

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

I have to create a slicer with 3 boxes: "over threshold", close threshold", "within the threshold" and I have 4  categories of people, "Chinese", "English" “italian”, “Spanish”. In the first box there must be all the people (Chinese, English, Italian e Spanish ) which have a negative number as a result of a measure (which is a delta). In the second box: if "Chinese" from 0 to 50 (this because their threshold is 100), if other countries from 0 to 100 (the threshold is 200); in the third box all the other possibilities except those just described.

If correct, the slicer will return in a table only the names of the people in the 3 categories I mentioned above. I hope I have been clear enough.

Thanks in any case for the help you will know give me.

Best regards

Hi @Mussaka ,

What output do you really want? I can't understand it with all words, can you provide data and the desired output so that I can help you better.

 

Like the following:

vpollymsft_0-1676337148132.pngvpollymsft_1-1676337157262.png

How to Get Your Question Answered Quickly 

 

Best Regards
Community Support Team _ Polly

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

I should create a visual object like this below with the characteristics that I expressed in the previous post (I am not able to explain better); Can you help me? Thank you

Mussaka_0-1676357564565.png

 

Refer the file shared by @v-rongtiep-msft  and make required changes as shown in the below images to obtain the results.
VishalJhaveri_0-1676360099034.pngVishalJhaveri_1-1676360244106.png

VishalJhaveri_2-1676360442457.png

 


Thank you. 
If my answers helps you please mark it as solution.

 

Thank you very much!

How could I apply the formula you showed me to create a conditional formatting with the colors in the icons? I mean...IF('OT_fact (1) original'[Annual Delta Treshold vs. OT]>=100,"Within Threshold" (one color of the icon, for example yellow circle), IF('OT_fact (1) original'[Annual Delta Treshold vs. OT]<0,"Above Threshold", (another icon color, for example blue circle), IF('OT_fact (1) original'[Annual Delta Treshold vs. OT]<= 50&&'OT_fact (1) original'[Roster.CCNL UPDATED]="CREDIT","Near Credit" (another color) and so on....

Thank you again

In my previous request I was referencing a table where a person had a single row, but now I realize that a person can have multiple rows based on the reporting period. So, one row for January, one for February and so on. If I apply the same measure you suggested, it gives me an error. I also tried to create and then merge another table in which I grouped all the rows, but for the type of work I have to do it is necessary that the rows, while adding together, keep the value present in each row . It is very complex to explain, I hope someone understands and suggests a solution. Thanks in advance

Anyone who can answer me?

Thank you in advance

amitchandak
Super User
Super User

@Mussaka , Assume you have measure X

 

Then a new measure

Switch(true(),

[X] < 0 , "over threshold" ,

[X] < 100 , "close threshold" ,

"within the threshold")

 

 

Same way you can create color measure and use that in conditional formatting using field value option

 

Switch(true(),

[X] < 0 , "Red" ,

[X] < 100 , "yellow" ,

"green")

 

Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

 

The problem is that "x" is not a measure, but a column; this is because I need to use it in a filter:(

The criteria must be the following:

- if (name of the table[measure]<0, "over threshold"

- if (name of the table[measure]<100, "close threshold"

- if (name of the table[measure]<50, (only for a determined number of persons, for example "english")"close threshold"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors