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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
sunny27
Frequent Visitor

SQL to DAX

Hello All,

 

Can you please help me to write SQL query in DAX please. Below is the query

 

select count(*) from(
SELECT * FROM A WHERE ABTypeID
IN (10,11,12,13) and
BAID IN
(SELECT BAID FROM AB WHERE
CAID IN
(select CAID from ABC)))

 

Thanks!!

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @sunny27,

 

Could you please mark the proper answers as solutions?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @sunny27,

 

It could be like below. But it depends on the data model structure. If you want a precise one, please provide a sample. 

Measure =
VAR baids =
    CALCULATETABLE ( VALUES ( ab[baid] ), ab[caid] IN VALUES ( abc[caid] ) )
RETURN
    CALCULATE (
        COUNTROWS ( a ),
        a[abtypeid] IN { 10, 11, 12, 13 }
            && a[baid] IN baids
    )

Best Regards,

Dale

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

You will need this add in tool from now on if you are building a lot of DAX queries in Excel for PowerPivot and Tabular.

 

Go To this link:

 

http://daxstudio.org/downloads/

 

Select the most current, first, download.

 

You can just run it after the download as a standalone app or open Excel and run it under Add In.

 

DaxStudio has everything you need.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.