what is var in dax code? how can learn faster to write long dax code?
Keyword to declare variables
Here’s a thread with some resources that I think you’ll find very helpful in mastering the use of variables. Understanding proper use of variables is one of the absolutely fundamental skills necessary to write anything more than basic DAX code.
In addition to studying these resources, I 100% agree with @AntrikshSharma that practice and more practice is the key. Through initiatives like Problem of the Week and the Data Challenges, we offer a lot of different opportunities for that structured learning and practice. In addition, you can learn a great deal by reading DAX -related forum posts (I literally learn something new about DAX from every @AntrikshSharma post) and also attempting to solve other peoples’ DAX problems , whether you post a solution or not.
I hope this is helpful. Good luck with your study.
P.S. I also used to think the goal was learning to write long, complex DAX. I now realize the better goal is to write the shortest, simplest DAX that will solve your problem. The way to do that is often not to write DAX at all, but to focus first on structuring your data and performing necessary calculations and transformations in Power Query. The lesson I learned is that you need to have a balanced study plan, advancing your skills equally in both tools.
It is a general question.
However, I’d say that If VAR is used in the DEFINE section of an EVALUATE statement, it can be used in any expression of the statement and the RETURN keyword cannot be used.
It does worth to watch Sam’s video:
Hi @dipeshkumar30 , did the response provided by the experts help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark the thread as solved. Thanks!
Hi @dipeshkular30, we’ve noticed that no response has been received from you since the 5th of January. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!
A response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!
thanks a lot to everyone.
@dipeshkumar30 variables are a very, very powerful tool of Power BI and I suggest you to see this if you want to use efficiently variables: