Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can you please help me switch the following ifs to set analysis
=if([A_Date]>='04/01/2014',if(IsNull(Price),[G_Price],Price))
Thanks for the help!
Hi there,
Make something this changes:
1) Create a Price master Field in the Script like this:
if(IsNull(Price),[G_Price], Price) as PriceMaster,
2) Create a Flag for the date
if([A_Date]>='04/01/2014', 1, 0) as Flag
3) Finally make your set analysis expression:
=sum({$<Flag = '1'>} PriceMaster)
Hope this way helps you
Regards,
MB
Is this an expression or is this a dimension?
Let me check.. sorry!
Hi,
Is this trying to just show a field or you trying to sum or something similar?
Looks like you want if as you are trying to conditional show a field value.
Mark
May be this:
Alt(
Only({<A_Date = {"$(='>=' & Date(MakeDate(2014, 4, 1), 'MM/DD/YYYY'))"}>} G_Price),
Only({<A_Date = {"$(='>=' & Date(MakeDate(2014, 4, 1), 'MM/DD/YYYY'))"}>} Price))
I am assuming your date format is MM/DD/YYYY -> April 1st 2014 (04/01/2015)
Update: Messed up the order
Alt(
Only({<A_Date = {"$(='>=' & Date(MakeDate(2014, 4, 1), 'MM/DD/YYYY'))"}>} Price),
Only({<A_Date = {"$(='>=' & Date(MakeDate(2014, 4, 1), 'MM/DD/YYYY'))"}>} G_Price))
Hi there,
Make something this changes:
1) Create a Price master Field in the Script like this:
if(IsNull(Price),[G_Price], Price) as PriceMaster,
2) Create a Flag for the date
if([A_Date]>='04/01/2014', 1, 0) as Flag
3) Finally make your set analysis expression:
=sum({$<Flag = '1'>} PriceMaster)
Hope this way helps you
Regards,
MB
How about doing the isnull check in the load script such as ,if(IsNull(Price),[G_Price],Price)as newprice
then in expression something like the following
=sum({<[A_Date]={">=04/01/2014"}>}newprice)
By the way... this method that I've written is in my humble opinion the most efficient way to implement what you're trying to do, considering the best perfomance.
PS: If you want you can mantain your expression using a variable like this:
Let vStartDate = '04/01/2014';
And then use it in the creation of Flag field like this:
if([A_Date]>=$(vStartDate), 1, 0) as Flag,
Can I offer an improvement here:
If Price is truly null
Alt(Price, [G_Price]) as PriceMaster,
or this
If(Len(Trim(Price)) > 0, Price, G_Price) as PriceMaster