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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PatrycjaDz
Regular Visitor

Calculation regarding the last calender week of the data in report

Hello, 

 

I'm calculating number of shipments pro depatment for the actual and last week. 

 

At the beginning those calender weeks were hard coded

then I tried it with TODAY() but I've got problems with the report on every monday, cause I'm updating earliest on Tuesday and on Monday the measures switched to new calender week already without having the updated data 

 

so now I tried a solution with to take MAX of Dates of my data to retrieve calender week, but for some data - I've got multiple departments - calender week 25 ist the max - and not 29 - as for the the whole data set - so I had to remove filters. 

 

Somehow I can't manage to remove it. 

 

I have a measure for the last week: 

CALCULATE(
                    WEEKNUM(MAX('Rohdaten Serviceentwicklung'[Date]),21),
                     REMOVEFILTERS(Profitcenter[PC]
)
 
which correctly shows 29
 
but as soon as I try to include this one in my calculation of shipments - I've got false results. 
this measure is: 
CALCULATE(  [Sendungsanzahl],

                                        FILTER(Calender,Calender[KW]=[my measure for calender week]),

                                        Calender[Aktuelles Jahr Flag]=1  

                                        )
 as soon as I replace this measure with "29" - i've got correct result. 
I have this measure on visual and it shows 29 so I don't get it at all.. 
 
maybe somebody can help please? 
 
Thanks in advance! 
 

 

1 REPLY 1
some_bih
Super User
Super User

Hi @PatrycjaDz based on your inputs, it seems that part  REMOVEFILTERS(Profitcenter[PC])  cause your "false" result in "another" place as this part of code literaly remove filters from Profitcenter.

Try following, even not tested as your dataset is not available

VAR _your_calculation_of_values_calendar=[my measure for calender week]

RETURN
CALCULATE( [Sendungsanzahl],

FILTER(Calender,Calender[KW]=_your_calculation_of_values_calendar),

Calender[Aktuelles Jahr Flag]=1

)

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

 





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

Proud to be a Super User!






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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