Forum Discussion

ryan_b_fiting's avatar
ryan_b_fiting
Post Patron
5 years ago

Calculation Group - Calculation Item Measure Help

Hello Community - 

I am in need of some help writing a calculation item within my calculation group.  I currently have a calc group with 4 items in it and then it is pulled into a matrix against some of my base measures (as rows).

Here are calculation item DAX measures:

YTD = 

CALCULATE ( SELECTEDMEASURE(), DATESYTD ( Date_Table[Date] ) )

PYTD = 

VAR _YTD = CALCULATE ( SELECTEDMEASURE(), DATESYTD ( Date_Table[Date] ) ) 
RETURN CALCULATE
( SELECTEDMEASURE() , SAMEPERIODLASTYEAR ( Date_Table[Date] ) )

YoY Value = 

VAR _CY = selectedmeasure() 
VAR
_LY = calculate ( selectedmeasure(), sameperiodlastyear(Date_Table[Date]))
RETURN
_CY - _LY

YoY % = 

VAR _CY = selectedmeasure() 
VAR
_LY = calculate ( selectedmeasure(), sameperiodlastyear(Date_Table[Date]))
VAR
_YoY = _CY - _LY
RETURN DIVIDE
(_YoY,_LY,0 )

 Now I am trying to created a calculation item that will give me the COUNT of the customers that had YoY growth > 0 and a calculation item that will SUM the growth of those customers (for Sales, GP1 and Lines only).

If I create this basic measure, I get the output that I want, but I cannot add it to my matrix as a column (next to my calculation item measures).

 

Lines Up = CALCULATE(
    COUNTROWS( SUMMARIZE('Master_Tbl','Master_Tbl'[Customer])),
    FILTER( SUMMARIZE('Master_Tbl','Master_Tbl'[Customer] ), [YoY Lines] > 0 )
    )

 

How can I replicate the above measure as a calcluation item for only Sales, GP1 and Lines, leaving all other row measures in my matrix blank?

 

Your help is always appreciated!

Ryan

2 Replies

  • ryan_b_fiting , I think, very similar to YOY.

     

    example

     

    Lines Up =
    VAR _CY = selectedmeasure()
    VAR _LY = calculate ( selectedmeasure(), sameperiodlastyear(Date_Table[Date]))
    VAR _YoY = _CY - _LY

    CALCULATE(
    COUNTROWS( SUMMARIZE('Master_Tbl','Master_Tbl'[Customer])),
    FILTER( SUMMARIZE('Master_Tbl','Master_Tbl'[Customer] ), _YoY > 0 )
    )

    • ryan_b_fiting's avatar
      ryan_b_fiting
      Post Patron

      amitchandak thanks for the reply.  I have already tried that, but that does not work.  That gives me the same value across all base measures, and it does not allow me the 'BLANK' value measures that I do not want to see YoY count for (only want to see it for Sales, Lines, GP1)