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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

how to calculate

Hi all,

 

I am trying to calculate like SQL query using dax function.

          SELECT COUNT(*) FROM TABLE

          WHERE ID IN (SELECT ID FROM TABLE WHERE TYPE = 'ISSUE')

          AND TYPE = 'USE';

Can anyone teach me how to use dax function and filter from below table?

 

multt0_0-1643084540106.png

 

  multt0_1-1643084575179.png


Thank you in advance.

1 ACCEPTED SOLUTION

@Anonymous , Try like

measure =
var _tab = summarize(filter(allselected(Table),Table[TYPE] = "ISSUE"), Table[ID])
return
countrows(filter(Table,Table[TYPE] = "USE" && Table[ID] in _tab))

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Create a measure like

 

measure =
var _tab = summarize(filter(Table,Table[TYPE] = "ISSUE"), Table[ID])
return
countrows(filter(Table,Table[TYPE] = "USE" && Table[ID] in _tab))

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
Anonymous
Not applicable

Thank you for your answer.

I tried the way you told me.

But I don't know why "2022-01-02", "2022-01-03" doesn't come out of the results like below.

multt0_0-1643086544888.png

multt0_1-1643086677484.png

 

 

@Anonymous , Try like

measure =
var _tab = summarize(filter(allselected(Table),Table[TYPE] = "ISSUE"), Table[ID])
return
countrows(filter(Table,Table[TYPE] = "USE" && Table[ID] in _tab))

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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
Anonymous
Not applicable

Thank you so much!!!

I solved it with the answer:)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.