Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I use this formula to calculate sum for the current year. .
if(GetSelectedCount ([Month])> 0 or GetSelectedCount(Year)> 0, Sum([g.SellingAmount]), Sum ({<Date = P({<Year={$(=max(Year(today())))}>}Date)>}[g.SellingAmount]))
The field g.sellingAmount has different values and how can I change this formula to access only one of them. I want to calculate the sum for the current year only for one of them..
You can use Name1 inside your set analysis
if(GetSelectedCount ([Month])> 0 or GetSelectedCount(Year)> 0, Sum([g.SellingAmount]), Sum ({<Name1={*},Date = P({<Year={$(=max(Year(today())))}>}Date)>}[g.SellingAmount]))
this will caluclate for name 1 column's too.
Many Thanks
Karthik
Hi,
try below method,
u can simply try to use set analysis expression like below
Sum ({$<Year ={"$(=Max(Year))"} >} [g.SellingAmount])
or
u can try to add current year YTD flag in your calendar script
LET vMinDate = num(Peek('MinDate'));
LET vMaxDate = num(Peek('MaxDate'));
LET vToday = vMaxDate;
InYearToDate(CalDate,$(vToday),0) * -1 as CurrYTDFlag,
InYearToDate(CalDate,$(vToday),-1) * -1 as LastYTDFlag,
then u can use it
Sum ({$<CurrYTDFlag={1} >} [g.SellingAmount])
Thanks,Deva
Thank you for your help.
but I have a different question.
For example, in this field we have 'Name1', 'Name2', 'Name3','Name4',columns and I want to calculate only for 'Name1''s sum for the current year.
In this formula, all values are calculated. and I want to change this in such way to show only one of them.
if(GetSelectedCount ([Month])> 0 or GetSelectedCount(Year)> 0, Sum([g.SellingAmount]), Sum ({<Date = P({<Year={$(=max(Year(today())))}>}Date)>}[g.SellingAmount]))
You can use Name1 inside your set analysis
if(GetSelectedCount ([Month])> 0 or GetSelectedCount(Year)> 0, Sum([g.SellingAmount]), Sum ({<Name1={*},Date = P({<Year={$(=max(Year(today())))}>}Date)>}[g.SellingAmount]))
this will caluclate for name 1 column's too.
Many Thanks
Karthik
Thank you very much It works