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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Janewhite
Frequent Visitor

Dax error

This SQL Script please how can this be written in DAX

 

 

SELECT
(TO_CHAR(DATE_TRUNC('month', CONVERT_TIMEZONE('UTC', 'Europe/London', CAST(store_open AS TIMESTAMP_NTZ))), 'YYYY-MM')) AS "scheduled_month",


( COUNT(DISTINCT case

when Year_sales != No Sales'
or (case
when Store_Close = 1 then true
when  Store_Close = 0 then false
end) = true
then Store_ID
else null
end ) ) * 1.0
/ nullif(( COUNT(*) ),0)


1 REPLY 1
KNP
Super User
Super User

Really hard to help with the info given.

Would need to see the complete SQL, your current data model/relationships, and preferably, some sample data from the relevant tables.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors