Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello
How do I move this MySQL query to Power BI DAX?
SELECT COUNT(total) AS Contador, Sum(cantidad) as canti FROM (SELECT COUNT(*) AS total,sat_reparacion.cantidad FROM sat_reparacion INNER JOIN sat_lineas ON sat_reparacion.codigo_reparacion=sat_lineas.documento GROUP BY sat_lineas.documento HAVING (SUM(sat_lineas.pvp)=0)) ";
Thank you.
Solved! Go to Solution.
Hello,
Not sure of what you are trying to achieve doing this but :
Contador = COUNTROWS(
FILTER(
SUMMARIZE(
FILTER(
sat_reparacion,
CALCULATE(SUM(sat_lineas[pvp])) = 0
),
sat_lineas[documento],
"Contador", COUNTROWS(sat_reparacion),
"canti", SUM(sat_reparacion[cantidad])
),
[Contador] > 0
)
)
Igna
It's perfect! Thank you
The explanation of what I wanted is:
I've got these two boards
Table of Controls
control |
T1 |
T2 |
T3 |
T4 |
T5 |
Table of Lines Controls
control | pvp |
T1 | 0 |
T1 | 0 |
T1 | 0 |
T2 | 3 |
T2 | 4 |
T3 | 0 |
T4 | 1 |
T4 | 1 |
T4 | 1 |
As you can see, control T1, the sum of pvp in the table lines controls is 0, control T3 also adds 0, so the expected result I would want would be 2, since controls with 0 are 2
Anyway, with the previous measure it has worked perfectly for me.
Best regards
Happy to hear 🙂
Can you mark this topic as solved ?
Best regards,
Igna
Sorry
I have a similar query but I'm not able to get it in DAX. The new query is:
SELECT COUNT(total) AS Contador
FROM (
SELECT COUNT(*) AS total FROM sat_reparacion INNER JOIN sat_lineas ON sat_reparacion.codigo_reparacion=sat_lineas.documento
WHERE
(
no_reparable=0 OR no_reparable IS NULL
)
AND (
garantia = 0 OR GARANTIA IS NULL
)
GROUP BY sat_lineas.documento
HAVING (SUM(sat_lineas.pvp)=0
)
)t1
Let's see if you can give me a hand.
Thank you.
Hello,
Not sure of what you are trying to achieve doing this but :
Contador = COUNTROWS(
FILTER(
SUMMARIZE(
FILTER(
sat_reparacion,
CALCULATE(SUM(sat_lineas[pvp])) = 0
),
sat_lineas[documento],
"Contador", COUNTROWS(sat_reparacion),
"canti", SUM(sat_reparacion[cantidad])
),
[Contador] > 0
)
)
Igna
User | Count |
---|---|
119 | |
66 | |
66 | |
56 | |
50 |
User | Count |
---|---|
177 | |
84 | |
70 | |
64 | |
54 |