cancel
Showing results for
Did you mean:
Frequent Visitor

## how to count values of a measure

Hi Experts,

I need help on how to count data that is resulted from a measure.

As per the below screenshot, I used the "Datadiff" function to get the numbers between 2 different dates "POR to Scopping" . Now i need to count how many "POR to scopping" that are more than 14 . The problem is that "POR to Scopping" is a measure and i can't get the "Count " function to work for measures and it only worke for columns!

1 ACCEPTED SOLUTION
Super User

Use COUNTX or COUNTROWS. Build a table using FILTER and perhaps ADDCOLUMNS that represents your table. Then use COUNTX against that table, perhaps with an additional filter for > 14. For example:

```Measure Count =
VAR __table = ALL('Table')
VAR __table1 = ADDCOLUMNS(__table,"__MyMeasure",[Measure])
RETURN
COUNTROWS(FILTER(__table1,[__MyMeasure] > 14))```

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
2 REPLIES 2
Super User

Use COUNTX or COUNTROWS. Build a table using FILTER and perhaps ADDCOLUMNS that represents your table. Then use COUNTX against that table, perhaps with an additional filter for > 14. For example:

```Measure Count =
VAR __table = ALL('Table')
VAR __table1 = ADDCOLUMNS(__table,"__MyMeasure",[Measure])
RETURN
COUNTROWS(FILTER(__table1,[__MyMeasure] > 14))```

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

HI Dreg,

Thanks for the feedback!

I got it working by using the below statment :

Number of sites exceeding "POR To Scopping" Std Interval =
CALCULATE(COUNTA('Query1'[Site ID]), FILTER(Query1,Query1[POR to Scoping]>=14),FILTER(Query1,Query1[Site Scoping Sts]="P"))

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

#### Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors