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
Nagin
Frequent Visitor

Whole Month Activity

Hi,

 

I am trying to create a DAX measure to median and mean to show only whole month activity, as per the chart below, the trend dips in July as it does not include the full month data, internally the data warehouse is refreshed mid month and therefore would have this issue every month. This is there a measure that I could use that would only include data for a entire month and not partial month activity, so for the chart below I would like to show all data upto end of June. 

 

Currently I just have a simple measure to calulate ether mean or median; 

 

LOS Mean = AVERAGE( (ECDS[Hospital_Spell_Duration_D])
LOS Median = MEDIAN( (ECDS[Hospital_Spell_Duration_D])
 
The date field that I would use to idenify activity would be  "Admission_Date_Hospital_Provider_Spell"
 
Nagin_1-1660571641353.png

 Thanks

 Nagin

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Nagin 

I made the measure for Mean, you can repeat the same for Median

LOS Mean  = 
IF(
    EOMONTH( MAX(ECDS[Admission_Date_Hospital_Provider_Spell]),0)  <= 
    CALCULATE( MAX(ECDS[Admission_Date_Hospital_Provider_Spell]), REMOVEFILTERS(ECDS)) ,
    AVERAGE(ECDS[Hospital_Spell_Duration_D])
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@Nagin 

I made the measure for Mean, you can repeat the same for Median

LOS Mean  = 
IF(
    EOMONTH( MAX(ECDS[Admission_Date_Hospital_Provider_Spell]),0)  <= 
    CALCULATE( MAX(ECDS[Admission_Date_Hospital_Provider_Spell]), REMOVEFILTERS(ECDS)) ,
    AVERAGE(ECDS[Hospital_Spell_Duration_D])
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Nagin
Frequent Visitor

Hi @Fowmy 

 

Thanks worked perfectly

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.

Top Solution Authors