Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi all,
I have a question about writing a DAX function to analyse different rows of data either in the same table or across other tables.
I am trying to solve it but it seems harder than it looks.
Thanks with Regards,
Solved! Go to Solution.
Hi @Masoud_ ,
This should work for you. Add it as Calculated Column
Result =
VAR V_Date = 'Table Test'[Time]
VAR V_Filter = FILTER('Table Test', [Time] > V_Date)
VAR V_NextRow = MINX(V_Filter, [Time])
Var Result = MINX(FILTER(V_Filter, [Time] = V_NextRow), [Celsius])
RETURN IF(OR(Result-'Table Test'[Celsius]<-3,Result<35),0,IF(OR(Result-'Table Test'[Celsius]>3,Result>35),1,0))
Change the table/column names to yours. If this works for you, please accept my answer. 🙂
Hi @Masoud_ ,
This should work for you. Add it as Calculated Column
Result =
VAR V_Date = 'Table Test'[Time]
VAR V_Filter = FILTER('Table Test', [Time] > V_Date)
VAR V_NextRow = MINX(V_Filter, [Time])
Var Result = MINX(FILTER(V_Filter, [Time] = V_NextRow), [Celsius])
RETURN IF(OR(Result-'Table Test'[Celsius]<-3,Result<35),0,IF(OR(Result-'Table Test'[Celsius]>3,Result>35),1,0))
Change the table/column names to yours. If this works for you, please accept my answer. 🙂
Hi @davehus,
Thank you for your answer.
It worked perfectly. Also, please introduce me to if you know any excellent sources for learning DAX coding, like working with variables and defining functions.
Kind Regards,
Masoud
User | Count |
---|---|
116 | |
73 | |
61 | |
48 | |
47 |
User | Count |
---|---|
173 | |
123 | |
60 | |
59 | |
57 |