Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
In table I have a "Date" column, "Customer ID" column & "Category" Column, now what I need is that if we select multiple dates in slicer then it must return the count of "Customer ID" for the previous for all selected dates in slicer.
I have created below measure but it work on single selection, not on multiple selection:
Thanks!
Hi @mohittimpus ,
You may add ALLSELECTED function in your formula like DAX below to take effect of the slicers or filters.
Previous Week = var SelectedDate = SELECTEDVALUE(Sheet2[Date])
var PreviousWeek = SelectedDate-7
return CALCULATE(COUNT(Sheet2[CustomerID]), FILTER(ALLSELECTED(Sheet2), Sheet2[Date]=PreviousWeek))
By the way, we have no access to your sample data as you showed. You can also upload sample pbix to OneDrive (you can find it in following location) and post the link here. Do mask sensitive data before uploading.
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xicai,
The measure does not work even with single selection of date. It should also work with time range and multiple selection of date. Please find the onedrive link for the file:
https://1drv.ms/u/s!AntMLanyDcxuaiesR6lsXng84Zk?e=cakl14
Thanks
Hope you have created a date table using calendar. If not please make one.
Create a week behind measure
CALCULATE(COUNT(Sheet2[CustomerID]), dateadd(date[date],-7,DAY))To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Thanks @amitchandak,
It work fine with date, I also have "Time Range" column, I also need to consider it, what changes I need to made in measure.
Please find the .pbix file attached:
https://drive.google.com/file/d/1e7uC84v0gjT6dYiOavrCnwhPCKQdXkHD/view?usp=sharing
Thanks
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 51 | |
| 37 | |
| 35 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 72 | |
| 70 | |
| 39 | |
| 34 | |
| 23 |