Forum Discussion
why 1st expression work but 2nd expression not working ?
Hi All
I have 1 st expression working fine :-
Expense On Sales & Promotion =
CALCULATE(SUM(GL_TI[C/D]),
Fin_Category[Summary]="SALES & RPOMOTION")*-1
Anuual Total_1 =
VAR Summary = SELECTEDVALUE(Format_PnL[Sub Category])
VAR Category =SELECTEDVALUE(Format_PnL[Category])
RETURN SWITCH(TRUE(),
SELECTEDVALUE(Format_PnL[Sub Category])="SALES & PROMOTION",[Expense On Sales & Promotion],
CALCULATE([Total Profit],FILTER(GL_TI,GL_TI[GL Description]=Category)))
See below image , it return SALES & PROMOTION With value is correct :-
Below is my 2nd expression not working :-
Expense On General & Admin Expense =
CALCULATE(SUM(GL_TI[C/D]),
Fin_Category[Summary]="GENERAL & ADMIN EXP")*-1
Anuual Total_2 =
VAR Summary = SELECTEDVALUE(Format_PnL[Sub Category])
VAR Category =SELECTEDVALUE(Format_PnL[Category])
RETURN SWITCH(TRUE(),
SELECTEDVALUE(Format_PnL[Sub Category])="SALES & PROMOTION",[Expense On Sales & Promotion],
SELECTEDVALUE(Format_PnL[Sub Category])="GENERAL & ADMIN EXP",[Expense On General & Admin Expense],
CALCULATE([Total Profit],FILTER(GL_TI,GL_TI[GL Description]=Category)))
See below image , it still return SALES & PROMOTION With value is not correct , as it never return General & Admin Expense :-
My PBI file :-
https://www.dropbox.com/s/3z2h6o6lf4bcks1/GL_WORKING%20v005.pbix?dl=0
Paul
admin11 , please check the second name is not complete (It is GENERAL & ADMIN EXPENSE). Also, this will work when you have a slicer
2 Replies
- amitchandak
Super User
admin11 , please check the second name is not complete (It is GENERAL & ADMIN EXPENSE). Also, this will work when you have a slicer
- admin11
Memorable Member
amitchandak Thank you very much , i looking at wrong column , now i start to understand the data model.