Forum Discussion
Date formula
I need to create a formula that will allow me to look at data from one date MINUS data from another date.
i.e. what is the difference in $ between Sunday, December 2 and Monday, December 3. I would like this to be a dynamic formula as each day I need to see the detail between the current snapshot and the Sunday snapshot. The next in line would be the difference in $ between Dec 2 - Tues Dec 4, etc, etc This is done by week, on a daily basis.
Any help would be greatly appreciated!
Try something like this:
DynamicSalesDifference =
var TodaySales = Calculate(Sum(FactInternetSales[SalesAmount]), DimDate[Date] =Today())
var SundaySales = Calculate(Sum(FactInternetSales[SalesAmount]), WEEKNUM(DimDate[Date]) = WEEKNUM(Today()) && WEEKDAY(DimDate[Date]) = 1 && Year(DimDate[Date]) = YEAR(TODAY()))
return TodaySales - SundaySalesReplace all FactInternetSales[SalesAmount] and DimDate[Date] with your own fields.
Regards
2 Replies
- parry2kSuper User
SES78 can you share sample data and expected output. Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 - JasonTXResolver I
Try something like this:
DynamicSalesDifference =
var TodaySales = Calculate(Sum(FactInternetSales[SalesAmount]), DimDate[Date] =Today())
var SundaySales = Calculate(Sum(FactInternetSales[SalesAmount]), WEEKNUM(DimDate[Date]) = WEEKNUM(Today()) && WEEKDAY(DimDate[Date]) = 1 && Year(DimDate[Date]) = YEAR(TODAY()))
return TodaySales - SundaySalesReplace all FactInternetSales[SalesAmount] and DimDate[Date] with your own fields.
Regards