Variables in measures wrong results

Hi everyone,

I want to have your opinion about this question: I love variables and I really appreciate the utility of them when I had to write complex measures.

But sometimes (and I don’t know and understand why) when I use a variable in a measure, this measure takes to a wrong results. Instead when I write the expression of the variable in formula, measure calculates correct results.

I bring an example, which refers to calculation of total average sales.


And also this occured to me with regards to the use of RANKX in order to rank customers by sales.

I would really appreciate your experience and opinion about it.

Matteo-Italy

Hi @Matteo-Italy Refer to the following comprehensive discussion regarding variables:

Thanks.

Hi @Matteo-Italy, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster. While waiting for a response, here are some tips so you can get the most out of the forum and other Enterprise DNA resources.

  • Use the forum search to discover if your query has been asked before by another member.
  • When posting a topic with formula make sure that it is correctly formatted to preformatted text </>.
    image
  • Use the proper category that best describes your topic
  • Provide as much context to a question as possible.
  • Include the masked demo pbix file, images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

I also suggest that you check the forum guideline How To Use The Enterprise DNA Support Forum. Not adhering to it may sometimes cause delay in getting an answer.

Please also check the How To Mask Sensitive Data thread for some tips on how to mask your pbix file.

Thank you @MudassirAli for indicating me the thread.

Problem solved.