March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everyone, I'd be very greatful if someone could help me out!
I am trying to compute new customers [newcustomercount] and have used the dax code used here for this:
https://www.sqlbi.com/articles/computing-new-customers-in-dax/
I have also created a copy of my 'Date' table called 'PreviousDate' to be able to select a single month in a visual and get 6 months filter the previous 6 months of the date table. Code for this has come from here:
https://www.youtube.com/watch?v=d8Rm7dwM6gc&t=601s
Here is a link to my pbix file in case you'd like to check it out! Thanks if you do!
https://drive.google.com/drive/folders/1j93uX4dUL6JoTJxDt3LMPWdHQD0_Nssj?usp=sharing
The Problem
I have noticed that I get a different result when,
calling a measure within calculate:
[prev6mths|callingmeasure]
.........
VAR Result =
CALCULATE(
[newcustomercount],
REMOVEFILTERS ('Date'),............
vs.
writing the measure within calculate:
[prev6mths|writtingmeasure]
................
VAR Result =
CALCULATE(
COUNTROWS (
FILTER (
CALCULATETABLE (
ADDCOLUMNS (
...............
Results:
Relationships:
My Measures:
How frustrating, that no one knows how the calculate function will perform in certain scenarios. I guess seeing as there are no other replies to this everyone is in agreeement with you Greg. Which is scary for me as you guys know more than just about anyone else about this language. The idea that sometimes calculate works and sometimes it doesn't and we can't clearly identify when these failures occur is terrible. I think this one flaw should be enough to drive anyone away from using DAX (with it's popular calculate methodology). I was really hoping that I was missing something sublte which would explain why some filters are or aren't being propagated through the code I wrote.
Thanks @Greg_Deckler I watched your video.
@Lhans One of the many reasons to avoid CALCULATE IMHO. Plus you are using TI functions and that's not idea. CALCULATE and the TI functions are pretty much black boxes that you can't really troubleshoot.
It's really not an uncommon problem. See this video link which shows the same kind of problem even with a simple SUM measure. The link should be to the exact time in the video where I discuss this. If it doesn't work, skip to 26:13.
@Ritaf1983 @parry2k @Ahmedx @Ashish_Mathur @lbendlin @kpost @jdbuchanan71 @Greg_Deckler @MFelix Really appreciate it if any of you guys have an idea why there is a difference calling a measure provides the wrong result 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
106 | |
98 | |
65 | |
54 |