Forum Discussion

Fusilier2's avatar
Fusilier2
Helper V
2 years ago
Solved

Help with % measure

Hi,

I have a this measure to count rows of data by answer category:

AnswerCount = COUNTROWS('Combined Table').
I've created this matrix using it:

I want to display the answer category as a % of all categories in a line chart but can't work out the syntax for the measure.

I've managed to add in the %CT column as 'show values as % of column Total'

 

But when I try to display this in a line chart it is showing different percentages:

Can anybody help me with the measure please or what am I doing wrong with what I've done so far?

Thanks!

 
 
  • Fusilier2 So I would think your measure would need to be something like this for the line chart:

    Measure =
      VAR __CurrentCount = COUNTROWS( 'Combined Table' )
      VAR __Year = MAX( 'Combined Table'[Year] )
      VAR __Table = FILTER( ALL( 'Combined Table' ), [Year] = __Year )
      VAR __AllCount = COUNTROWS( __Table )
      VAR __Result = DIVIDE( __CurrentCount, __AllCount )
    RETURN
      __Result
    

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Fusilier2 So I would think your measure would need to be something like this for the line chart:

    Measure =
      VAR __CurrentCount = COUNTROWS( 'Combined Table' )
      VAR __Year = MAX( 'Combined Table'[Year] )
      VAR __Table = FILTER( ALL( 'Combined Table' ), [Year] = __Year )
      VAR __AllCount = COUNTROWS( __Table )
      VAR __Result = DIVIDE( __CurrentCount, __AllCount )
    RETURN
      __Result
    
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Fusilier2 ,

     

    Did you solve your problem, if so, you can mark the correct answer, if not, provide more detailed information and we can help you better!

     

    Best Regards,

    Liu Yang

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