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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Gabriel_Pedri
Resolver I
Resolver I

Filtering through Power BI Measures

I have a date calculated through a measure. I want to use this date to return the value of another measure:

 

CALCULATED DATE

 

Date Variation = MAX('Calendar'[Date]) - [PMP]

 

TOTAL STOCK

 

Total Stock =

SUMX(FILTER(

Stock,

(Stock[AccountName] = "account1" ||

Stock[AccountName] = "account2" ||

Stock[AccountName] = "account3"

),

Stock[Value]

 

MEASURE FILTERED BY ANOTHER MEASURE

 

Total Stock PMP =

CALCULATE(
[Total Stock],

FILTER('Calendar',

'Calendar'[Date] = [Date Variation]
))

 

However, the output of Total Stock PMP returns BLANK because of [Date Variation] = 18/11/2022. This happens due to the specific day set by the filter. There are no values in the stock on the 18th.

I want to find a method that does not filter exactly this date but instead only the month and year, thus taking the entire month's range!

I've tried using ALL, STARTOFMONTH, ENDOFMONTH, FORMAT. However, all of them give some kind of error.

1 ACCEPTED SOLUTION

I managed to achieve the final result through this:

 

Total Stock PMP =
VAR month = MONTH([Date Variation])
VAR year = YEAR([Date Variation])

RETURN
CALCULATE(
[Total Stock],
FILTER (
ALL('Calendar'),
'Calendar'[MonthN] = month &&
'Calendar'[Year] = year
)
)

 

Thank you for your attention.

 

Best regards!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Personally I usually add something like this to my date table

Corey_M_0-1704904975811.png

in your case it would be month instead of weeks

I managed to achieve the final result through this:

 

Total Stock PMP =
VAR month = MONTH([Date Variation])
VAR year = YEAR([Date Variation])

RETURN
CALCULATE(
[Total Stock],
FILTER (
ALL('Calendar'),
'Calendar'[MonthN] = month &&
'Calendar'[Year] = year
)
)

 

Thank you for your attention.

 

Best regards!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.