bhavesh-jadav / Advance-Card

Advance Card Visual for Power BI
http://bhaveshjadav.in/powerbi/advancecard/
GNU General Public License v3.0
25 stars 12 forks source link

"Conditions" Format Logic Not Properly Working #13

Closed markefrody closed 5 years ago

markefrody commented 5 years ago

Describe the bug The desired Foreground Color cannot be achieved using the specified "If Value Is". Please refer to screenshot in Screenshot section

To Reproduce Steps to reproduce the behavior: The conditions that I need are the following: 97-102 is green 103 -106 is yellow Above 106 is red

  1. Go to "Format" section.
  2. Go to "Conditions"
  3. Set the "No. of Conditions" to "3"
  4. Set the following If 4.1. First "If Value Is" to "<=", "Value" to "1.02", "Then Foreground Color" to red. 4.2. Second "If Value Is" to "<=", "Value" to "1.06", "Then Foreground Color" to yellow. 4.3 Third "If Value Is" to ">", "Value" to "1.06", "Then Foreground Color" to red.

Expected behavior The conditions that I set in order to change the foreground color should be applied to the card.

Screenshots Here is the card at 106%. It is showing red. This should be yellow: image

Here is the data type and format of the number: image

Desktop (please complete the following information): OS: Windows 2012 R2 Standard Browser: Internet Explorer 11 Version: 11.0.9600.19078

Smartphone (please complete the following information): Device: NA OS: NA Browser: NA Version: NA

Additional context Add any other context about the problem here.

bhavesh-jadav commented 5 years ago

@markefrody Thank you for detailed information.

The reason why it is showing red instead of yellow is because the value actually might be greater than 1.06 for example value might be 1.061, 1.0605, 1.06001 etc. (depends on decimal places you are using) which are all greater than 1.06. In percentage you are only showing 106 which is 1.06 but while checking conditions, Advance card will take all available decimal places into consideration. So in your case actual value for 106% might be greater than 1.06. You can check this by showing decimal places on percentage and see if it is exactly 106.000% and not like 106.005%. The 2 decimal places that you specified in Modeling tab is for formatting and display purpose only and it does not remove decimal from actual values. If you want to consider only 2 decimal places like you have mentioned in conditions, then either change decimal places to only 2 at source level or add new column using DAX ROUND( column_name, decimal_places ) function and drop that calculated column into condition field and it should work as expected.

let me know if that makes sense.