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 to all,
I'm writing to you because my query below doesn't work anymore for some time (an update of power bi maybe ?). Indeed I created this query to count the number of non empty values in a column. This query was working, it was counting the values at 0 as a value but recently it considers the values at 0 as a "blank".
Here is my query:
SUMX(
SUMMARIZE(
VALUES(dim_measure_faucon[libelle_mesure]),dim_measure_faucon[libelle_mesure],
"Pmoy",
CALCULATE(DISTINCTCOUNTNOBLANK(fact_measure_points_faucon[dt (10 min)]),FILTER(fact_measure_points_faucon,fact_measure_points_faucon[value]<>BLANK())
),
[Pmoy]
)
Can you please explain me why?
Thanks in advance,
Joël
Solved! Go to Solution.
You can try this:
SUMX(
VALUES(dim_measure_faucon[libelle_mesure]),
CALCULATE(
DISTINCTCOUNTNOBLANK(fact_measure_points_faucon[dt (10 min)]),
KEEPFILTERS(
NOT ISBLANK( fact_measure_points_faucon[value] )
)
)
)
// Bear in mind that T[C] <> BLANK
// also means T[C] <> 0 since
// BLANK = 0.
You can try this:
SUMX(
VALUES(dim_measure_faucon[libelle_mesure]),
CALCULATE(
DISTINCTCOUNTNOBLANK(fact_measure_points_faucon[dt (10 min)]),
KEEPFILTERS(
NOT ISBLANK( fact_measure_points_faucon[value] )
)
)
)
// Bear in mind that T[C] <> BLANK
// also means T[C] <> 0 since
// BLANK = 0.
First, the expression you've given is syntactically incorrect. Second, you should never, under any circumstances, use SUMMARIZE to do calculation in it. This function is predictable and relatively fast only when doing grouping with it. Do any other thing with it and you're out of luck. It means that even if today the function seems to do what you expect it to, tomorrow it will not be and you won't even notice it.
Please remove the calculation from under SUMMARIZE and use the ADDCOLUMNS/SUMMARIZE hybrid instead. However, I can see you don't even need SUMMARIZE in there for grouping. A simple VALUES or DISTINCT is enough.
I can't do anything more for you since the formula itself is not even correct syntactically, as I said.
By the way, if you want to really see how complex the SUMMARIZE function really is and how unpredictable its output can be, please get familiar with this: All the secrets of SUMMARIZE - SQLBI
And here's the closing remarks from @AlbertoFerrari:
Hello @Anonymous
Yes, it works. I didn't know that "summarize" was a function not to be used for calculations, when should it be used? Secondly, what do you call the hybrid function "ADDCOLUMNS/SUMMARIZE" please?
Thank you for your generous help, it helped me a lot!
Joël
Please read thoroughly all my replies and always follow the links that I place in there. Then everything will become clear.
Sorry @Anonymous I didn't see the whole of your answer,
Thanks again for your help,
Have a nice day,
Joël
Can you give an example of a table where this happens so we can try to reproduce what you describe?
Hello @AlexisOlson
Unfortunately I can't share my pbix but here is my table "fact_points_measures_faucon" in the image below :
And here is my "dim_measure_faucon" table
I hope this can help you !
Thanks in advance !
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
16 | |
15 | |
7 | |
7 |
User | Count |
---|---|
37 | |
31 | |
16 | |
16 | |
12 |