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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

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.