Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Transform SQL TO DAX

Hi Guys, i need convert this SQL to DAX, but i can't do it. I tryed several DAX, but i found several errors.

SQL:

 

 

 

 

 

 

SELECT NFS,COUNT(CPF) AS PESSOAS FROM
	(
	SELECT CL.CPF AS CPF,COUNT(FT.NOTA_FISCAL) as NFS FROM FT_FATURAMENTO AS FT
	INNER JOIN DM_CLIENTE AS CL ON CL.SK_CLIENTE = FT.SK_CLIENTE

	GROUP BY CL.CPF
	)AS TEMP
GROUP BY NFS
ORDER BY 1

 

 

 

 

 

I need a result like this:

Number of clients who bought 1 turn -------1 client

Number of clients who bought 2 turn -------10 client

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Could you share me some sample data and your expected result? Then I can test for you directly.

 

Reference: How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

 

 

Best Regards,

Icey

amitchandak
Super User
Super User

@Anonymous , You are looking for bucketing /binning. When a measure {COUNT(FT.NOTA_FISCAL) } is converted dimension using an independent table

 

refer these if, that can help you

 

https://www.daxpatterns.com/dynamic-segmentation/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization
https://youtu.be/CuczXPj0N-k

 

 

Create a measure of the count. Create a table with counts (Generateseries), Create a measure with CPF on the group by /values. Use = join with this new series table to get the correct value. 

Similar step is there for range in video, link 3

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.