Forum Discussion

SloeMo's avatar
SloeMo
Frequent Visitor
4 years ago
Solved

Conditional formatting Text count based as a % on the column total

Hi,

 

Apologies for posting this but I am having issues with conditional formatting text, I have tried reading variuous threads but cannot get my head into gear.

 

I have a text column called KRI Category, this contains values FP, IM, PS, Support. Within a matrix I can show a count of the values which are correct. I can add the same field to show the value as a % of the grand total. this also shows the correct %.

 

But how can I set conditional formatting to show metrics based upon the values in the matrix? I have tried rules based on number as decimal and numbers as a % and it is not correct.

 

Do I need to add a calcluated column or a measure to transform my text to a numeric value?

  • SloeMo No, not because it is text because you have the Count aggregation. But, what you need to be using is the %GT of Count of KRI Category. Of course, you probably don't have that available in the conditional formatting stuff. But, you could create a measure like:

    GT % Measure = 
      VAR __Count = COUNT('Table'[Count of KRI Category)
      VAR __AllCount = COUNTX(ALL('Table'),[Count of KRI Category])
    RETURN
      DIVIDE(__Count,__AllCount,0)

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    SloeMo You should be using the Number dropdown and not Percent. Should be something like if > 0 and <= .45 and > .45 and <= 1

    Or something like that.

    • SloeMo's avatar
      SloeMo
      Frequent Visitor

      thanks Greg_Deckler 

       

      I had tried that previously based on other threads but these are the results.

       

      Am I doing something wrong in the format, it looks like as I am using number as a rule nothing actually falls into the rule parameter as the actual lowest count in the data is 2. I need it work from a % as the numbers will change.

       

      Didn't know if this is because the column is text?

       

      Thanks

      Lee

      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        SloeMo No, not because it is text because you have the Count aggregation. But, what you need to be using is the %GT of Count of KRI Category. Of course, you probably don't have that available in the conditional formatting stuff. But, you could create a measure like:

        GT % Measure = 
          VAR __Count = COUNT('Table'[Count of KRI Category)
          VAR __AllCount = COUNTX(ALL('Table'),[Count of KRI Category])
        RETURN
          DIVIDE(__Count,__AllCount,0)