Forum Discussion
Anonymous
4 years agoNot applicable
Help in time related DAX
Hey Experts, I need help with dax. I have two columns one is SALE DATE and one is ORDER DATE. I need one column or measure according below condition, Ever order date has multiple sale date. ...
- 4 years ago
Hi, Anonymous ;
Try it.
result = VAR _min = CALCULATE ( MIN ( Data[Sale date] ),FILTER(ALLSELECTED('Data'),[Order date]=MAX([Order date]))) RETURN IF ( MAX( Data[Sale date] ) = _min, "Current", "Next")The final output is shown below:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tamerj1
Community Champion
4 years agoHi Anonymous
You can try this calculated column
Distribution Column: =
VAR CurrentSaleDate = Data[exp]
VAR CurrentOrderDateTable =
CALCULATETABLE ( Sheet1, ALLEXCEPT ( Sheet1, Sheet1[Date] ) )
VAR NumberOfSales =
COUNTROWS ( CurrentOrderDateTable )
VAR FirstSaleDate =
MINX ( CurrentOrderDateTable, Sheet1[exp] )
VAR Result =
IF (
NumberOfSales = 1,
"Current",
IF ( CurrentSaleDate = FirstSaleDate, "Current", "Next" )
)
RETURN
Result
- Anonymous4 years agoNot applicable
Measure working fine after adding filter value. But calculated column giving not proper result.
- tamerj14 years ago
Community Champion
Hi Anonymous
Would you please double check the code you're using as it works in sample file https://www.dropbox.com/t/yGBAowmIe1PHgg7b- tamerj14 years ago
Community Champion
Anonymous
Also I believe that the solution provide by Jihwan_Kim should work with no issues. Is there any chance that we are missing something here?