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
albatoul
Helper I
Helper I

Days of month

greeting good day every one 

I'm new in the power bi and I need help for my work 

 

PAT_DAYS_AP = SUM(Admit[Patient_DAYS_CAL])/60/60/24 

 

I used this query to calculate the total days of month and when i select Feb it's show 126 days not 28 but before it use to work photo.png

2 ACCEPTED SOLUTIONS
rbriga
Impactful Individual
Impactful Individual

COUNTROWS('Calendar') will work, assuming you have a calendar table- the same one you use to slice by dates, months or years.

Although you may wish to modify it with this:

CALCULATE(

COUNTROWS('Calendar'),

KEEPFILTERS('Calendar'[Date] < TODAY())

)

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

View solution in original post

v-jayw-msft
Community Support
Community Support

Hi @albatoul ,

 

What is this [Patient_DAYS_CAL] in your formula and what is the logic about the formula?

Does month slicer come from a date table or does it have a corresponding date?

If so you could use below measure.

Measure = 
var eom = CALCULATE(ENDOFMONTH('CALENDAR'[Date]),FILTER('CALENDAR','CALENDAR'[Month]=SELECTEDVALUE('CALENDAR'[Month])))
return
DAY(eom)

1.PNG

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

11 REPLIES 11
v-jayw-msft
Community Support
Community Support

Hi @albatoul ,

 

What is this [Patient_DAYS_CAL] in your formula and what is the logic about the formula?

Does month slicer come from a date table or does it have a corresponding date?

If so you could use below measure.

Measure = 
var eom = CALCULATE(ENDOFMONTH('CALENDAR'[Date]),FILTER('CALENDAR','CALENDAR'[Month]=SELECTEDVALUE('CALENDAR'[Month])))
return
DAY(eom)

1.PNG

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Good Day everyone 

 

Please I need your help very argent I have dashboard that work perfectly fine but after I refresh it it's show negative numbers which is not correct 

albatoul
Helper I
Helper I

still not working do you think maybe this is not the wrong column I tried to take more information from my manger he told me that the problem is that 

Occupancy Rate dose not show right it's should be something near 75% the only reason i can see is the Days 
column but i,m not sure 
albatoul
Helper I
Helper I

problem*

 

albatoul
Helper I
Helper I

still not working 💔 the peoplem is i'm not the one who create the dashboard it's from old employee

rbriga
Impactful Individual
Impactful Individual

We can create a new measure to overcome this. 

Are we just trying to find out how many days were in the selected period? 

In that case, if you have a calendar table (best practice), just use COUNTROWS(Calendar).

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

as I understand they want to show the months Days for Ex: FEB = 28 days and DEC = 31 days

rbriga
Impactful Individual
Impactful Individual

COUNTROWS('Calendar') will work, assuming you have a calendar table- the same one you use to slice by dates, months or years.

Although you may wish to modify it with this:

CALCULATE(

COUNTROWS('Calendar'),

KEEPFILTERS('Calendar'[Date] < TODAY())

)

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
albatoul
Helper I
Helper I

thank you for you answer 

 

it's show "The value for 'Patient_DAYS_CAL' cannot be determined. Either the column doesn't exist, or there is no current row for this column."

photo 3.pngphoto 2.png

rbriga
Impactful Individual
Impactful Individual

Patient_DAYS_CAL isn't your date field.

What's the date field you use for slicing months?

How about (Day(ENDOFMONTH([ADMIN_DARE])), assuming that's your leading date.

 

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
rbriga
Impactful Individual
Impactful Individual

Try

(Day(ENDOFMONTH([Your date field here]))

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

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.