Forum Discussion
BishwaR
Helper V
5 years agoModified Date Slicer
I have two tables Date Table and the Sales Fact Table as given in the pic I have one to many relationship btw them. Now I want to show in the power BI report only yesterday's sales (April 29,2...
- 5 years ago
Hi BishwaR ,
First create a column as below:
_rank = RANKX('Data','Data'[Sales Date],,ASC,Dense)Then create a measure as below:
Measure = var _rank=CALCULATE(MAX('Data'[_rank]),FILTER(ALL(Data),'Data'[Sales Date]=SELECTEDVALUE('Date Table'[Date]))) var _tab1=CALCULATETABLE(VALUES('Data'[Sales Date]),FILTER(ALL(Data),'Data'[_rank]=_rank-1)) var _tab2=CALCULATETABLE(VALUES(Data[Sales Date]),FILTER(ALL(Data),'Data'[_rank]>=_rank-3&&'Data'[_rank]<_rank)) Return IF(SELECTEDVALUE('Date Table'[Day])="Mon", IF(MAX('Data'[Sales Date]) in _tab2,1,BLANK()), IF(MAX('Data'[Sales Date]) in _tab1,1,BLANK()))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
sayaliredij
Solution Sage
5 years agoIn this case, you can create a calculation group with the same settings.
Just saying. in case you want to have only one filter and not have multiple measures
Thanks,
sayali
BishwaR
Helper V
5 years agoIf I create all the measures using this set of calculations will I be able to use other slicers like Product Category, Location etc ?
- sayaliredij5 years ago
Solution Sage
Yes I think so
Thanks,
sayali