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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

 










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


Proud to be a Super User!









"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

 










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


Proud to be a Super User!









"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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors