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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
BartoszKx
Regular Visitor

Measure doesn't work for records before specific date

Hi,

When I was trying to calculate average number of players in selected date range, i found out that measures doesn't work correctly for dates before 09-2014. I created this temporary measure:

tmp = CALCULATE(AVERAGEX('GameStatistics', [Avg players]), YEAR('GameStatistics'[Date]) = 2014, MONTH('GameStatistics'[Date]) = 😎


This returns blank, but if we replace 8 with 9 (September 2014) it results with 17,61

'GameStatistics' table contains data for August 2014: 

BartoszKx_1-1723802287264.png


'GameStatistic' is also in relation with Date Table:

BartoszKx_0-1723802175564.png

 

I also tried this formula:

tmp = CALCULATE(AVERAGEX('GameStatistics', [Avg players]), 'GameStatistics'[Year/Month] = "2014/8")

with same result as before.

What might be the case for this weird behaviour?
I would be very grateful for any help.


 

5 REPLIES 5
Anonymous
Not applicable

Hi @BartoszKx , rajendraongole1, thank you for your prompt reply!


Please create a simple measure to check if you could return month values in a table:

vyajiewanmsft_0-1724136839794.png

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous,

Thank you for your reply. This measure doesn't work in report. I can't retrive month from date column:

 BartoszKx_1-1724257276938.png

Here's sample data and report:
https://drive.google.com/file/d/1NdD5gDj1GWpa-6E-Zyk0yuBtH2wkP01K/view?usp=sharing

 

Anonymous
Not applicable

Hi  @BartoszKx

Thank you for your additional information, use All function to ignore any filters that might have been applied.

 

tmp = CALCULATE(AVERAGEX('GameStatistics','GameStatistics'[Avg players]), ALL(GameStatistics),YEAR('GameStatistics'[Date]) = 2014, MONTH('GameStatistics'[Date]) =8)
 

vyajiewanmsft_0-1724665491018.png

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

rajendraongole1
Super User
Super User

Hi @BartoszKx - Can you check there is no missing values, blanks in Date column also incorrect datatype also results blank.check the format in Game statistics table too as you have given relationship 

 

if possible share sample data in drive to look over that give us to analysis and share expectations.

 

Thank you

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1,

Thanks for your reply. Dates columns in 'GameStatistics' and 'DateTable', have same format and data type. There aren't any blank values in this columns either.

Link for sample data and pbix file:
https://drive.google.com/file/d/1NdD5gDj1GWpa-6E-Zyk0yuBtH2wkP01K/view?usp=sharing

After this post had been created i realised that tmp value somehow depends on filter applied with slider in report page. In sample data this measure behaves differently than in orignal pbix file. When I set slider like this:

BartoszKx_0-1724254519222.png

tmp measure has value. When begin of the slider is set to 2014-06-23, then tmp value is blank:

BartoszKx_1-1724254615566.png

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.