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
soldous
Advocate II
Advocate II

Different result for DAX measure when filtered out only relevant records with COUNTROWS

Hello,

 

I have a relatively simple measure for calculating differences of volumes between months.

Measure = SUM(Volume) - CALCULATE(SUM(Volume),PREVIOUSMONTH(MonthPeriod))

It works good in general but there are some issues.

I want to see only relevant months so I created a measure in my fact table and applied this measure as a filter on the visual where Rows are greater than or equal 1:

Rows = COUNTROWS(FactTable)

 

And finally, I have a slicer for year selection. When I choose one year or all it works good but when I choose more years from slicer I receive wrong value on the start of each year (not the delta but only the SUM(Volume). The reason is that CALCULATE(SUM(Volume),PREVIOUSMONTH(MonthPeriod)) is null for the first month of each selected year. I don't know why. For the first selected year, it is understandable but why for the second selected as well? 

 

Could someone help me, please?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

DATEADD( MonthPeriod, -1, MONTH )? Is MonthPeriod a DATE? If it's not, then you know why it does not work. As I already said, time-intel functions need a date column (without gaps) to work correctly.

Best
D

View solution in original post

10 REPLIES 10

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