Scenario:
Suppose we have a Sample Data with Sales (Qnty_Sold) for non consecutive Order Dates as follows:
The simple Data Model is as follows, where Calendar date is connected to the Order date of the sample data.
Now we will calculate the Sales Growth from Previous Non Consecutive dates using the below DAX Logics:
Suppose we have a Sample Data with Sales (Qnty_Sold) for non consecutive Order Dates as follows:
Now we will calculate the Sales Growth from Previous Non Consecutive dates using the below DAX Logics:
Total Sales = SUM(tbl_Sample[Qnty_Sold])
Prev Sales =
VAR _PrevDate =
MAXX(
FILTER( ALLSELECTED(tbl_Calendar[cDate]),
tbl_Calendar[cDate] < SELECTEDVALUE(tbl_Calendar[cDate])
),
tbl_Calendar[cDate]
)
VAR _PrevSales =
CALCULATE( [Total Sales],
FILTER( ALLSELECTED(tbl_Calendar[cDate]), tbl_Calendar[cDate]= _PrevDate)
)
RETURN
_PrevSales
Sales Growth =
IF ( [Prev Sales]<>0 && [Total Sales]<>0, DIVIDE([Total Sales],[Prev Sales])-1 )
No comments:
Post a Comment
Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.