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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
darko861
Resolver II
Resolver II

Group and Count with DAX

Hi,

I have the following query in SQL server that I would like to recreate in Power bi with DAX. How can I create a measure or table with his query. Thank you very much.

 

[v_rpt_Service].[status_description] AS 'Label', COUNT([v_rpt_Service].[SR_Service_RecID]) AS 'Value'
FROM [v_rpt_Service]
WHERE ([v_rpt_Service].[Closed_Flag] = 0)
GROUP BY [v_rpt_Service].[status_description]
ORDER BY COUNT([v_rpt_Service].[SR_Service_RecID]) DESC;

 

LabelValue
Analyzing409
Waiting On Customer: User Acceptance95
Customer has updated89
Waiting On Customer: More Info72
On Hold67
Analyzing (Third line)65
Creating solution49
Waiting On Customer: Approve Estimate49
Internal45
Delivered27
Recieved22
Waiting for build19
Assigned18
*New16
Not Assigned15
Estimating14
Waiting On Development10
Testing solution9
Ongoing9
Re-Opened3
*Assigned1
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@darko861 , Create a measure like this

calculate(COUNT(v_rpt_Service[SR_Service_RecID]) , filter(v_rpt_Service, v_rpt_Service[Closed_Flag] = 0))

 

Use that with status_description on the visual. Order bu you can sort on visual.

 

 

 

Check DAX vs SQL - https://www.youtube.com/playlist?list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj

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

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@darko861 , Create a measure like this

calculate(COUNT(v_rpt_Service[SR_Service_RecID]) , filter(v_rpt_Service, v_rpt_Service[Closed_Flag] = 0))

 

Use that with status_description on the visual. Order bu you can sort on visual.

 

 

 

Check DAX vs SQL - https://www.youtube.com/playlist?list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj

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

thanks, but I got the following error message:

 

darko861_0-1617125533020.png

 

Thanks, I managed the conversion myself

@darko861 , can you share your formula?

If data type is an issue. check

calculate(COUNT(v_rpt_Service[SR_Service_RecID]) , filter(v_rpt_Service, v_rpt_Service[Closed_Flag] = "0"))

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

Hi Amit, I used the same formula. There was a data type issue with the source where 0 was converted to False and 1 was converted to True, so I made a quick conversion.

 

Thanks for the quick reply, it's much appreciated!

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.