The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello All,
I am currently creating an Overlap Dashboard within PowerBi. I'm having trouble understanding what a certain DAX function is calculating. If somone could help translate this Function into Pseudo Code, that would be very helpful, Thank you all!
Overlap in Days Value = SELECTEDVALUE('Overlap in Days'[Overlap in Days], 7)
Has Overlap = IF('MST - Rev3'[DateRangeCollisions]> 1, TRUE(), FALSE())
Solved! Go to Solution.
Hi wkay,
DateRangeCollisions =
VAR StoreNumber = SELECTEDVALUE ( 'MST - Rev3'[Store Number] )
VAR RemodelStart = SELECTEDVALUE ( 'MST - Rev3'[Remodel Start (E)] )
VAR RemodelStartLessOverlap = RemodelStart - 'Overlap in Days'[Overlap in Days Value]
VAR RemodelStartPlusOverlap = RemodelStart + 'Overlap in Days'[Overlap in Days Value]
RETURN
CALCULATE (
COUNTROWS ( 'MST - Rev3' ),
FILTER (
'MST - Rev3',
'MST - Rev3'[Store Number] = StoreNumber
&& 'MST - Rev3'[Remodel Start (E)] >= RemodelStartLessOverlap
&& 'MST - Rev3'[Remodel Start (E)] <= RemodelStartPlusOverlap
)
)
I've formatted your DateRangeCollisions measure and sprinkled in some usage of variables to make it easier to read. I trust you to take it from here.
P.S.: I'm guessing somebody else wrote this DAX and is no longer available to help you understand what's going on here. Please, if nothing else, let this be a lesson to document and make things more legible for future you and anybody else who has to look at your work. 🙂
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)
Proud to be a Super User! | |
Hi wkay,
DateRangeCollisions =
VAR StoreNumber = SELECTEDVALUE ( 'MST - Rev3'[Store Number] )
VAR RemodelStart = SELECTEDVALUE ( 'MST - Rev3'[Remodel Start (E)] )
VAR RemodelStartLessOverlap = RemodelStart - 'Overlap in Days'[Overlap in Days Value]
VAR RemodelStartPlusOverlap = RemodelStart + 'Overlap in Days'[Overlap in Days Value]
RETURN
CALCULATE (
COUNTROWS ( 'MST - Rev3' ),
FILTER (
'MST - Rev3',
'MST - Rev3'[Store Number] = StoreNumber
&& 'MST - Rev3'[Remodel Start (E)] >= RemodelStartLessOverlap
&& 'MST - Rev3'[Remodel Start (E)] <= RemodelStartPlusOverlap
)
)
I've formatted your DateRangeCollisions measure and sprinkled in some usage of variables to make it easier to read. I trust you to take it from here.
P.S.: I'm guessing somebody else wrote this DAX and is no longer available to help you understand what's going on here. Please, if nothing else, let this be a lesson to document and make things more legible for future you and anybody else who has to look at your work. 🙂
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)
Proud to be a Super User! | |
Thank you Wilson (a.k.a. (Resolver II)). This is the exact situation, I appreciate your help with this!
Happy to help. I forgot to mention daxformatter.com is a great resource for re-formatting your DAX. You eventually learn to format it that way - or at least in your own reader friendly style - pretty quickly. (Or at least I did! :D)
Proud to be a Super User! | |