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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count the number of values in a table

Hello

I try to figure out to do one simple thing and I would greatly appreciate any help.

 

I have a table like this :

 

Calendrier.[DATE]Calendrier.[Duration]
dd/mm/YYYY7
dd/mm/YYYY7,5
dd/mm/YYYY8
dd/mm/YYYY7,5
......

 

I would like to count the number of lines where the value equals 7,5 and the total number of lines.

Thank you for your help

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you so much for your solution.

Makes me want to quickly improve my skills with powerBI.

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

Total Lines = COUNTROWS(Calendrier)

 

7,5 lines = CALCULATE ( COUNTROWS(Calendrier), KEEPFILTERS(Calendrier[Duration] = 7,5 ) )
Anonymous
Not applicable

Hello thank you for your help.

 

The first formula works fine but the second doesn't, because I wasn't precise enough, I'm sorry.

 

My table is built like this :

- a date --> a duration

- a date --> a duration

- a date --> à duration

 

Sometimes, the date is the same (i can have several recording for, let's say, 2020/04/01 and I printed the total sum of the duration for this date).

 

That means i summed up several recordings to obtain this result.

 

Calendrier.[DATE]Calendrier.[Duration]
dd/mm/YYYY7
dd/mm/YYYY7,5
dd/mm/YYYY8
dd/mm/YYYY7,5
......

 

Now I would like to have the number of lines where the sum of the duration, for each day, equals 7,5.

 

I really hope my explanations were clear enough.

 

Best regards

 

Anonymous
Not applicable

Thank you so much for your solution.

Makes me want to quickly improve my skills with powerBI.

In my example I have a measure called [DurationSum]

DurationSum = SUM ( Calendrier[Duration] )

 Then this measure will count the rows where DurationSum = 7,5

7,5 count =
COUNTROWS (
    FILTER (
        ADDCOLUMNS ( VALUES ( Calendrier[Date] ), "x", [DurationSum] ),
        [x] = 7,5
    )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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