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

Count number on values (which are measure) in a table

I have a table which is the monthly average of a group of data, and at the same time is the hourly average of that month.

MonthHourAve_soure1Measure_1
Jan0

-5

 
Jan1-5 
Jan2-5 
Jan3110.2%
Jan4571.8%
Jan51403.6%
Jan6763.2%
Jan7181.1%
Jan8-5 
Jan9-5 
Jan10-5 

And I would like to add a column which count each value in my Measure_1 column in this table.

Measure_2 = 
CALCULATE(
    COUNTAX('Fact Table_TIME', [Measure_1]),
    FILTER('Fact Table_TIME', [Hour])
)

Because what I am having is the count of values of the raw data which I use it to construct this average table.

What I have:


MonthHourAve_soure1Measure_1Measure_2
Jan0

-5

  
Jan1-5  
Jan2-5  
Jan3110.2%

1

Jan4571.8%2
Jan51403.6%2
Jan6763.2%2
Jan7181.1%2
Jan8-5  
Jan9-5  
Jan10-5  

I do not know why I am having this result, but what I want it is :

MonthHourAve_soure1Measure_1Measure_2
Jan0

-5

  
Jan1-5  
Jan2-5  
Jan3110.2%

1

Jan4571.8%1
Jan51403.6%1
Jan6763.2%1
Jan7181.1%1
Jan8-5  
Jan9-5  
Jan10-5  

So the total count will be 5. 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

please try

Measure_2 =
COUNX ( SUMMARIZE ( 'Fact Table_TIME', [Month], [Hour] ), [Measure_1] )

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I couldn't put the filter [Month], because it is in another fact table “Fact Table_DATE", and I saw it is not necessary to put [Month] in this case.
However, may I ask you two questions @tamerj1:
1. If I want to add a filter [Month] from another fact table, how I can add it ? (just for knowledge) 
2. Can you explain why the function COUNTX and SUMMArize works well in this case? 

And thanks for the solution 🙂 

@Anonymous 
I guess the table names that you are using are somehow confusing. My understanding that both 'Fact Table_DATE & Fact Table_TIME' are actually dim tables that are filtering a fact table (Let's call 'Fact Table'). So you can do

Measure_2 =
COUNTX (
    SUMMARIZE ( 'Fact Table', 'Fact Table_DATE'[Month], 'Fact Table_TIME'[Hour] ),
    [Measure_1]
)

Summarizing with the right columns is required to achieve the correct granularity at which we want to the measure to be evaluated. Iterating this table will guarantee that the outcome of the evaluation of the measure matches the evaluation at the visual row level. While iteration over the entire table row by row will result in a diffirent evaluation of the measure.

tamerj1
Super User
Super User

Hi @Anonymous 

please try

Measure_2 =
COUNX ( SUMMARIZE ( 'Fact Table_TIME', [Month], [Hour] ), [Measure_1] )

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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