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
tbrown33
Regular Visitor

Data Model measure not working

This measure was created on a data model to show the average over time to include months an entry may not be made.  This worked fine until an update was made to the model.   The new model is built in a virtualization tool (online database) that integrates the tables into a model before it is published out to Power BI.  With this format the date table in integrated into the model and does not show as a separate table.  This measure no-longer works with the new model.  It does not add a 0 to field that is blank.   We are unable to figure out why.    

Test Average Total Hours per YearMonth =

AVERAGEX(

KEEPFILTERS(VALUES(DimCalendar[FYMonth])),

CALCULATE(IF([Total Regular&Premium Hours]= BLANK(),0, [Total Regular&Premium Hours])))

 

tbrown33_0-1652910559857.png

 

This is what a visual should look like when it is properly averaging

 

What could be the cause of this?

4 REPLIES 4
tbrown33
Regular Visitor

Thanks guys.  These options have been tried, but the measures still aren't adding a 0 to the Matrix.  Power BI won't allow me to change FYMonth to a date.  Even as a decimal the 0 isn't being added.         

Hi, @tbrown33 

Please try follow steps:

Add a new seperated table for DimCalendar[FYMonth] and establish a relationship between the new table and your original table.

New table =
DISTINCT ( DimCalendar[FYMonth] )

Then in the matrix visual, you need to replace your original field ‘DimCalendar[FYMonth]’  with the new field ‘NewTable[FYMonth]’. In this way, your original measure should work.

 

Best Regards,
Community Support Team _ Eason

 

Ashish_Mathur
Super User
Super User

Hi,

Try this

Measure = coalesce([Total Regular&Premium Hours],0)

Measure 2 = averagex(values(DimCalendar[FYMonth]),[measure])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@tbrown33 , I doubt you should use 0, assume this is a measure - [Total Regular&Premium Hours]

 

AVERAGEX(VALUES(DimCalendar[FYMonth]),[Total Regular&Premium Hours])

 

or

 

AVERAGEX(VALUES(DimCalendar[FYMonth]),[Total Regular&Premium Hours]+0)

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

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.