Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
This one is so dumb that I won't even go into the whole spiel. DATESBETWEEN is basically a glorified FILTER statement. The code for the DATESBETWEEN equivalent that works with DirectQuery and RLS is the code up to and including the __DATESBETWEEN variable.
ToHellWithDATESBETWEEN =
VAR __StartDate = MINX(ALL(ProductInventory[Date]),[Date]) //could be anything, this emulates BLANK()
VAR __EndDate = MAX(ProductInventory[Date]) //could be anything
VAR __DATESBETWEEN =
DISTINCT(
FILTER(
SELECTCOLUMNS(
ALL('ProductInventory'),
"Date",[Date]
),
[Date] >= __StartDate && [Date] <= __EndDate
)
)
RETURN
SUMX(FILTER(ALL('ProductInventory'),[Date] IN __DATESBETWEEN),'ProductInventory'[UnitCost]*'ProductInventory'[UnitsBalance])
If you want the full story, similar to how I recreated all of those Excel functions, my next fun project is unwiding the insanity that are the DAX Time Intelligence Functions. Sure, I started that a long time ago but might as well get specific. BTW, this all started with To **bleep** With STARTOFQUARTER.
eyJrIjoiMjFhMzRhYWItNTEzNi00ODZhLTllNDQtMzRiNzg2ZDkyNWU3IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9