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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
damit23183
Microsoft Employee
Microsoft Employee

Create Flag for Last 2 weeks of data.

Hi,

 

I would like to create flag for current max week and last week data only.

For example, I have this table -

Test.png

I would like to create dynamic flag like this 

 

 

Test.png

 

However, next week it should be look like this;
Test.png

Thus, every week flag will change based on max current week and previous week of max week.

 

Any help will be appreciated.

 

I have tried following solution;

 

1) Rankx

2) Create variable with max week then compare with dim date table.

3)Swithc function with max week = week from dim_date && max week-7 = week from Dim_Date-7.

 

Thank you in advance!

1 ACCEPTED SOLUTION
danextian
Super User
Super User

hI @damit23183 ,

Please try this:

Flag =
VAR __MAX_WEEK =
    MAX ( 'Table'[Week] )
RETURN
    __MAX_WEEK - 'Table'[Week] <= 7

danextian_0-1687826417884.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
danextian
Super User
Super User

hI @damit23183 ,

Please try this:

Flag =
VAR __MAX_WEEK =
    MAX ( 'Table'[Week] )
RETURN
    __MAX_WEEK - 'Table'[Week] <= 7

danextian_0-1687826417884.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi,

 

Thank you for your response and solution that worked perfectly fine.

 

Thanks

Helpful resources

Announcements
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.

May 2025 Monthly Update

Fabric Community Update - May 2025

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