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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Vinit
Frequent Visitor

DAX to count of rows from New Measure column

Hello All,

Purpose:

I required DAX formula for 'Count greater than 100 of Order Since column ' . Order since is Direct Query Meaure column

Vinit_1-1669011920150.png

 

e.g. ( Order Since = DATEDIFF(SELECTEDVALUE('Production Ready'[orderdate]),TODAY(),DAY)  )

 

Explanination:

I want DAX  in Direct Query to calculate for how many times the value is greater than 100 in order since column. i.e. 20 times,

to put value (20) into Card Tile. so that i can create alert in power bi service

 

Suggestions:

If you have any other solution, Please suggest.

 

Let me know, if require any other clarification

Thanks,

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

You would need a measure with the code below:
 
100PlusCount = 
COUNTROWS(
    FILTER(
    ALL(TableName), 
    TableName[Order Since]>=100
    )
)

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

You would need a measure with the code below:
 
100PlusCount = 
COUNTROWS(
    FILTER(
    ALL(TableName), 
    TableName[Order Since]>=100
    )
)

Hi FreemanZ,

above shared DAX is working but it shows wrong count no. 

If I used 'ALL' inside FILTER then it shows 28k (which is completely wrong. and does not change with Date slicer) but If I used 'ALLSELECTED' then it shows nearer to value but not correct.

Vinit_0-1669016257049.png

I can see only 6 values which is above 100, but it shows 19. 

and the value should change according to Date changes. 

 

Let me know anything required,

Thanks.

 

Is [measure 2] really a measure? try to change it to column name - Order Since

Yes, It is a measure. I Rename it as 'Order Since'

Measure 2 = Order Since = DATEDIFF(SELECTEDVALUE('Production Ready'[orderdate]),TODAY(),DAY)

the screenshot is basically a record table, suggest to add a new column in your table, with such code:

Order Since = TODAY() - TableName[Order Dt.],

 

then use this code for the measure:

100PlusCount := 

COUNTROWS(
    FILTER(
    TableName, 
    TableName[Order Since]>=100
    )
)

Yes it is record table. it is connected to postgresql database. and it came as Direct query

as you mention, not able to add column due to error 

Order Since = Today() - 'Poduction Ready'[orderdate]  i.e. 'Production Ready' is table name.

 

Vinit_0-1669026886850.png

and so,

100PlusCount := 

COUNTROWS(
    FILTER(
    'Production Ready', 
   'Production Ready'[Order Since]>=100
    )
)             is not applied.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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