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
channah
Regular Visitor

show negative numbers as a positive

I have data that I am showing both issues when numbers are over a certain threshhold - to correct those issues but I also want to show when the numbers are below the value and are able to handle more in those classes  - so i can show when a class is in violation and when it is not but keeping them separate so I can use conditional formating to distinguish it  - I could just use the same column and create a background conditional format to show negative and positive but I cannot create the negative numbers

 

Class total

Total composition factor (max 3)

Max size based on comp factor

Excess of size

Excess of composition

 

26

5

26

0

2

 

27

5

26

1

2

 

24

3

26

0

0

Would like a column that says 2 spaces available for size and 0 for composition

25

2

26

0

0

Would like it to say 1 space for size and one for composition in a separate column

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @channah ,

 

I assume that the table you show is the data as you have setup on your model correct?

 

I create the two following measures:

 

Excess/Space for composition = SUM(Composition[Total Compositon factor]) - 3 

Excess/Space for size = SUM(Composition[Class Total])- SUM(Composition[Max sized compositoon])

Now you can use the condittional formatting option on your table.

composition.png

 

Not really sure if your question was that you couldn't create the negatives or you didn't want to create the negatives.

 

If you want to show 4 columns you must do the 4 measures below:

 

Excess compostion = var composition_size = SUM(Composition[Total Compositon factor]) - 3 
Return
IF(composition_size>0; ABS(composition_size);0)

Excess size = var size_variation = SUM(Composition[Class Total])- SUM(Composition[Max sized compositoon])
return
IF(size_variation >0 ; ABS(size_variation);0)


Space compostion = var composition_size = SUM(Composition[Total Compositon factor]) - 3 
Return
IF(composition_size<0; ABS(composition_size);0)


space size = var size_variation = SUM(Composition[Class Total])- SUM(Composition[Max sized compositoon])
return
IF(size_variation <0 ; ABS(size_variation);0)

See attach PBIX file.

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

5 REPLIES 5
MFelix
Super User
Super User

Hi @channah ,

 

I assume that the table you show is the data as you have setup on your model correct?

 

I create the two following measures:

 

Excess/Space for composition = SUM(Composition[Total Compositon factor]) - 3 

Excess/Space for size = SUM(Composition[Class Total])- SUM(Composition[Max sized compositoon])

Now you can use the condittional formatting option on your table.

composition.png

 

Not really sure if your question was that you couldn't create the negatives or you didn't want to create the negatives.

 

If you want to show 4 columns you must do the 4 measures below:

 

Excess compostion = var composition_size = SUM(Composition[Total Compositon factor]) - 3 
Return
IF(composition_size>0; ABS(composition_size);0)

Excess size = var size_variation = SUM(Composition[Class Total])- SUM(Composition[Max sized compositoon])
return
IF(size_variation >0 ; ABS(size_variation);0)


Space compostion = var composition_size = SUM(Composition[Total Compositon factor]) - 3 
Return
IF(composition_size<0; ABS(composition_size);0)


space size = var size_variation = SUM(Composition[Class Total])- SUM(Composition[Max sized compositoon])
return
IF(size_variation <0 ; ABS(size_variation);0)

See attach PBIX file.

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks - yes basically i want to show and then use conditional formatting to make it noticeable, that if there is no issue with class size or composition - how many spaces are available - right now if there are no issues it shows a 0 - I wouldnt mind making 4 columns since newby users are using the tool and we want to be able to see what classrooms have space at a quick glance 

 

however when I use the measures and add them to my visual - all of the students who have a 0 their data all disappears ???

 

i already have the size and composition measures 

Students in excess of class size (S1) = if([MStudentCount]-[MMaxSize]<0,0, [MStudentCount]-[MMaxSize])
this determines that based on type of special needs student the class size varies, 1 or 2 Compositon Violation, 1 less student 2 or more composition violation student, 2 less students in class
 
Students in excess of compositon (S2) = IF(COUNTROWS(VALUES(TblDemo[Teacher_name]))=1,IF([McompositionViolation NC]>3,[McompositionViolation NC]-3,0))
the composition is max 3, else in violation
 
do I still need to recreate the excess composition and size measures - or can i use these to create the space size?

Hi @channah,

You don't need to recreate the excess since you already have them, just create the space measures.

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.