Forum Discussion
calculate and sameperiodlastyear not working IF function
- Anonymous3 years ago
Hi abbytank ,
Actually, the function ISBLANK is to check whether a value is blank. But it will return a table when you apply the function SAMEPERIODLASTYEAR. You can find the details in the following links.
Best Regards
Thank you very much Anonymous for your supportive response.
I see your solutions is 100% working and providing the very desired result, but concern is:
This is working:
VAR _pysales =
CALCULATE ( [TotalSales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
return _pysalesAnd also, the following is working:
ISBLANK(SAMEPERIODLASTYEAR('Date'[Date]))
And even the first the part of the code is working, because when the previous years sales is empty (no sales on previous year) the result is working and showing "No Sales" result:
Previous_year_sales = if(ISBLANK(SAMEPERIODLASTYEAR('Date'[Date])),
"No Sales",
But the problem is, when the calculate function or even sumx function put on the IF functions as (if function's) return values (return values on true or false) according to the following:
Previous_year_sales = if(ISBLANK(SAMEPERIODLASTYEAR('Date'[Date])),
"No Sales",
CALCULATE([TotalSales],
SAMEPERIODLASTYEAR('Date'[Date]))
)
So, why calculate is not working in IF function's argument, that is my concern?
Thank you very much.
Hi abbytank ,
Actually, the function ISBLANK is to check whether a value is blank. But it will return a table when you apply the function SAMEPERIODLASTYEAR. You can find the details in the following links.
Best Regards