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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
damit23183
Employee
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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