Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone,
Could someone please explain why I'm getting duplicate values even though my query is supposed to prevent them? And if possible, suggest a solution to fix it.
Best regards,
Ornella
Solved! Go to Solution.
Hi @Ornella ,
Thank you for reaching out to Microsoft Fabric Community Forum.
@burakkaragoz @lutz_bendlin Thank you for your quick response.
Could you please try the below SQL query:
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY CAST(DATE_EXEC AS DATE) ORDER BY DATE_EXEC DESC) AS rn
FROM XXXX_CTRL_CARD
WHERE CAST(DATE_EXEC AS DATE) = CAST(GETDATE() AS DATE)
)
DELETE FROM CTE WHERE rn > 1;
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Hi @Ornella ,
Thank you for reaching out to Microsoft Fabric Community Forum.
@burakkaragoz @lutz_bendlin Thank you for your quick response.
Could you please try the below SQL query:
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY CAST(DATE_EXEC AS DATE) ORDER BY DATE_EXEC DESC) AS rn
FROM XXXX_CTRL_CARD
WHERE CAST(DATE_EXEC AS DATE) = CAST(GETDATE() AS DATE)
)
DELETE FROM CTE WHERE rn > 1;
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Hello @v-bmanikante
Thank you for your prompt response. I had already implemented it.
Best regards,
Ornella
Hi @Ornella ,
Unexpected duplicates usually show up when your JOIN brings in more rows than expected—especially if the table you're joining to has multiple matching rows.
A couple of things to check:
If you can share a simplified version of your query and table structure, happy to take a closer look!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
Isn't your query equivalent to
DELETE FROM XXXX_CTRL_CARD
WHERE CAST(DATE_EXEC as DATE) <= GETDATE()
?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |