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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.