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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Sharpey
New Member

Calculation result wrong using CountRows ?

I am new to Dax so hopefully someone can point out what I am doing wrong.

 

I have a formula to count rows based on a slicer selection. This is setup as a measure.

SelectedCount = COUNTROWS(ALLSELECTED(MeetingRoomStats_20190523[RoomName]))
This returns a whole number and it works correctly
 
I would like to use this Measure in a another measure
PercUTIL = DIVIDE(DIVIDE(MeetingRoomStats_20190523[Duration],MeetingRoomStats_20190523[wrkingHours]),[SelectedCount])

The returned value is incorrect when using the "selectedCount" measure.

When using the measure and one count is returned the result is 0.05 but when I enter the value of 1 the correct value is retuned 0.27.

PercUTIL = DIVIDE(DIVIDE(MeetingRoomStats_20190523[Duration],MeetingRoomStats_20190523[wrkingHours]),1)
I cannot seem to figure out of it is a format issue or my lack of knowledge either way.
Any help would be greatly appreciated.

 

5 REPLIES 5
Arjunarao
Resolver I
Resolver I

Try this way.

 

PercUTIL =
VAR DurationWorking =
DIVIDE (
MeetingRoomStats_20190523[Duration],
MeetingRoomStats_20190523[wrkingHours]
)
RETURN
DIVIDE ( DurationWorking, [SelectedCount] )


@Arjunarao wrote:

Try this way.

 

PercUTIL =
VAR DurationWorking =
DIVIDE (
MeetingRoomStats_20190523[Duration],
MeetingRoomStats_20190523[wrkingHours]
)
RETURN
DIVIDE ( DurationWorking, [SelectedCount] )


This works but returns the same incorrect result. Although I like your formating much better then mine

Can you please attach sample file?
Use https://www.daxformatter.com/ for formmating of your DAX code.
Anonymous
Not applicable

HI @Sharpey ,

Can you please share some sample data to help us clarify your scenario?

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Sure Sorry @Anonymous I was away

 

Duration - 467.50

PercUTIL - Measure calulation " PercUTIL = DIVIDE(DIVIDE(MeetingRoomStats_20190523[Duration],MeetingRoomStats_20190523[wrkingHours]),[SelectedCount])"

WrkingHours- 1736

SelectedCount - Measure Calculation "
SelectedCount = COUNTROWS(ALLSELECTED(MeetingRoomStats_20190523[RoomName]))"
RoomName = Room1

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.