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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
diogovaz
Frequent Visitor

DAX Formula for Measure

Good Evening,

I have this query in SQL

SELECT COUNT ( DISTINCT ID)
FROM
(SELECT DISTINCT ACC.ID
FROM ACC
INNER JOIN PKG ON (PKG.ACC_ID = ACC.ID AND PKG.create_timestamp>='2017-12-01 00:00:00' AND PKG.create_timestamp<='2018-01-01 00:00:00'
UNION
SELECT DISTINCT ACC.ID
FROM ACC
INNER JOIN OWN ON OWN.USER_ACC_ID = ACC.ID
INNER JOIN PASS ON PASS.OWNER_ID = OWN.ID AND PASS.create_timestamp>='2017-12-01 00:00:00' AND PASS.create_timestamp<='2018-01-01 00:00:00') TAB

There is any way to build this query in a Measure ?

 

Best Regards and Thanks,

Diogo

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

Why would you want to do that versus just using this SQL Query as part of your import from your SQL database? I'm not sure I understand the ask here. Measures don't return tables generally.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Dear @Greg_Deckler,

 

I don't want to return table. If you see in the query I want to count how much disctinct ID's I have. In the data set model I already have the 4 tables that are in the query. 

 

My main purpose is only to count how many differents ID's I have since this will change everyday.

 

Thanks,

Diogo 

You can probably use DISTINCTCOUNT and/or DISTINCT. If you can post example data then I could be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.