Forum Discussion

Raj123's avatar
Raj123
Frequent Visitor
2 years ago
Solved

Creating extra line or in totals showing the difference between two rows

Hi,
I have matrix visual which has AgentID in row and Date in Column- grill down to month and measure in values.
My condition is to create extra line in row  or to show in total, the measure difference between "agentID 1" and "agentID 3"

(1-3).

I have added two sample table to show what i have and what i need. 

 

Thanks in advance.

 

Current Output

Year2022  
Agent IDJanFebMar
1102030
251015
3246
Total173451

 

Required Output

Year2022  
Agent IDJanFebMar
1102030
251015
3246
Total81624
  • Raj123 try this, you can tweak the solution as you see fit.

     

    Sales = SUM ( Table[Sales] )
    
    Agent 1 Sales = CALCULATE ( Table[Sales], Table[Agent] = 1 )
    Agent 3 Sales = CALCULATE ( Table[Sales], Table[Agent] = 3 )
    
    Measure for Matrix = 
    IF ( HASONEVALUE ( Table[Agent] ), [Sales], [Agent 1 Sales] - [Agent 3 Sales] )

     

4 Replies

  • Hi Raj123 ,

     

    Is this calculation to be done always on first and last name on the table? So in this case is 1 - 3 but if you have any other will be the other values?

    • Raj123's avatar
      Raj123
      Frequent Visitor

      Hi MFelix ,
      This is always done on first and last name. that is 1 - 3.
      Thank you

  • Raj123 try this, you can tweak the solution as you see fit.

     

    Sales = SUM ( Table[Sales] )
    
    Agent 1 Sales = CALCULATE ( Table[Sales], Table[Agent] = 1 )
    Agent 3 Sales = CALCULATE ( Table[Sales], Table[Agent] = 3 )
    
    Measure for Matrix = 
    IF ( HASONEVALUE ( Table[Agent] ), [Sales], [Agent 1 Sales] - [Agent 3 Sales] )

     

    • Raj123's avatar
      Raj123
      Frequent Visitor

      parry2k  Thank you very much, it worked.Sorry, took time to reply,