The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I'm building PBI dashboards for a client who is migrating from another tool (Targit). Their current system has pretty robust dynamic date capabilities, allowing you to use a calendar selector to alter the 'as of' date on the dashboards. Meaning if I were viewing a dashboard that had measures for sales and goals (derived from different fact tables), the reporting tool had built in comparisons for YTD vs PY YTD that I could apply to the visual. That visual would default to today's date, but I could drag that date back to any point in history. If I moved the date back to 12/31/23, I would then be looking at 1/1/23-12/31/23 vs 1/1/22-12/31/22. If I moved the date back to 6/30/23, then the comparison period would become 1/1/23-6/30/23 vs 1/1/22-6/30/22.
Their team has gotten used to this dynamic date flexibility and I'm trying to figure out how to replicate it, or get close, in PBI. We're working with a model being fed by a tabular cube, so most of the DAX is done in Visual Studio. I added current day/month/year offset values in my date table which I've used to build out YTD and PYTD measures in necessary tables, but that doesn't give me the ability to look back on demand.
I've tried using selectedyear and selectedyear -1 measures to add a date slicer option, but then I lose my ability to get that true yoy comparison when current year is incomplete and previous year is complete.
Any tips on how to alter the 'as-of' date relative to all dynamic measures?
@Kgi_jrd , You can use Preselected Slicer, to have selected value as today using measure-
With standard slicer you have to do work around with table
Is Today = if('Date'[Date]=TODAY(),"Today",[Date]&"")
Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA
Then you can use Time Intelligence
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),previousyear('Date'[Date]))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))
week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))
Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
I believe I've achieved something similar with day/month/year offset. Current value is 0, previous value is -1, etc. However, I've never been able to get the native time intelligence to work in visual studio...my formulas always end up blank. It's the same table used in the old olap cube that was powering the old reporting tool and the native time intelligence in that tool worked fine.
User | Count |
---|---|
15 | |
13 | |
9 | |
6 | |
6 |
User | Count |
---|---|
29 | |
19 | |
13 | |
8 | |
5 |