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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Karolina411
Helper V
Helper V

Ensuring Dates are factored into your Dax Command

Hello Power Bi Aces:  So...I used this Dax function: 

ReAdmit of Post_Admit = CALCULATE(DISTINCTCOUNT(PrePostAdmits[DurableKey]),FILTER(ALL(PrePostAdmits),PrePostAdmits[Readmit<30Days]=1 ||PrePostAdmits[PostAdmit]= 1))  where I have 4 different dates in MY table and am connecting my START date (when patient started in Case Management) and I am having to calculate the admission rates based on less than 30 days.  That being said the overall calculation works:  
%Total Readmits = [Readmission]/[Patient Count]
but when I break them down as in the first DAX formula with 2 factors and use the SAME denomintor:
%ReadmitsofPostAdmits = calculate([ReAdmit of Post_Admit]/[Patient Count]) (new Numerator ) it does not submit to the the date dimension and break it out among dates.  Should I change this formula:CALCULATE(DISTINCTCOUNT(PrePostAdmits[DurableKey]),FILTER(ALL(PrePostAdmits),PrePostAdmits[Readmit<30Days]=1 ||PrePostAdmits[PostAdmit]= 1))  - the number it outputs is correct but not across the dates?
Karolina411_0-1659547924553.png

 

 
3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Karolina411 ;

You could try it.

ReAdmit of Post_Admit =
CALCULATE (
    DISTINCTCOUNT ( PrePostAdmits[DurableKey] ),
    FILTER (
        ALL ( PrePostAdmits ),
        YEAR ( [date] ) = YEAR ( MAX ( 'table'[date] ) )
            && PrePostAdmits[Readmit<30Days] = 1
            || PrePostAdmits[PostAdmit] = 1
    )
)

Here 'table' could change to this table's name.

vyalanwumsft_0-1659927270571.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Karolina411 , I think you need measure similar to what I have discussed in HR Blog

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you.  I was planning to go toward this much more complex route but why does my same formula (

 

work for my initial % calc: 

Karolina411_0-1659628452413.png

%Total Readmits = [Readmission]/[Patient Count] - works
%ReadmitsofPreAdmits = [ReAdmit of Pre_Admit]/[Patient Count] does not work and I get infinity error
(
 
ReAdmit of Post_Admit = CALCULATE(DISTINCTCOUNT(PrePostAdmits[DurableKey]),FILTER(ALL(PrePostAdmits),PrePostAdmits[Readmit<30Days]=1 ||PrePostAdmits[PostAdmit]= 1))
 
I think the Numerator for ReAdmit of Post_Admit is not playing nice with my denominator.  Any suggestions are appreciated as I need to learn how to add Date Dimensions to my CALCULATE(DISTINCTCOUNT(PrePostAdmits[DurableKey]),FILTER(ALL(PrePostAdmits),PrePostAdmits[Readmit<30Days]=1 ||PrePostAdmits[PostAdmit]= 1))     How to add in Date Dim?
 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.