Forum Discussion

admin11's avatar
admin11
Icon for Memorable Member rankMemorable Member
5 years ago
Solved

How to insert condition into my _YTD_EXP_ expression ?

Hi All

I have below expression working fine.

_YTD_EXP_ = CALCULATE(CALCULATE(GL[AMOUNT_EXP_],DATESYTD('Date'[Date],"12/31")))
Above expression will display all expense.
 
i also i have below expression working fine , it can filter only expense for salary :-it is a column. the filter name is 1_EXP_SALARY
 
May i know how to insert 1_EXP_SALARY Into _YTD_EXP_ ?
 
My PBI sample file :-
 
Paul
 
  • Hi, admin11 

    Sorry, I don't quite understand what you mean. In your pbix, the 1_EXP_SALARY slicer can filter _YTD_EXP_ normally. Why do you still need to insert condition into my _YTD_EXP_ expression?

    Maybe you can try formula as below:

    _YTD_EXP_1 =
    CALCULATE (
        SUM ( GL[AMT] ) * 1,
        FILTER ( GL, GL[1_EXP] = "EXP" ),
        DATESYTD ( 'Date'[Date], "12/31" ),
        FILTER ( GL, GL[1_EXP_SALARY] = "Yes" )
    )
    

    Best Regards,
    Community Support Team _ Eason

2 Replies

  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity Support

    Hi, admin11 

    Sorry, I don't quite understand what you mean. In your pbix, the 1_EXP_SALARY slicer can filter _YTD_EXP_ normally. Why do you still need to insert condition into my _YTD_EXP_ expression?

    Maybe you can try formula as below:

    _YTD_EXP_1 =
    CALCULATE (
        SUM ( GL[AMT] ) * 1,
        FILTER ( GL, GL[1_EXP] = "EXP" ),
        DATESYTD ( 'Date'[Date], "12/31" ),
        FILTER ( GL, GL[1_EXP_SALARY] = "Yes" )
    )
    

    Best Regards,
    Community Support Team _ Eason