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
admin11
Memorable Member
Memorable Member

How to dynamic flag Jan till July when now is Aug ?

Hi All

 

I have posted below question :-

 

https://community.powerbi.com/t5/Desktop/How-to-hide-22-07-column/td-p/2671064

 

Can some one share with me how to dynamic flag YrMth ?

 

when now is 29 July 2022 , i will like to filter Jan till June , not include July.

when now is 1 Aug 2022 , i will like to filter Jan till July , not include Aug.

 

Need to use some thing month_n = 1

 

Paul

1 ACCEPTED SOLUTION

@admin11 
It should be a measure not a calculated column. 

View solution in original post

9 REPLIES 9
tamerj1
Super User
Super User

Hi @admin11 

you can create a filter measure 

IF ( Month ( MAX ( 'Date'[Date] ) ) < MONTH ( TODAY ( ) ), 1 )

Place it in the filter pane of the matrix visual, select "Is" and inser the value "1" then apply the filter. 

@tamerj1 

 

I have try your expression , when click on apply , it will filter off all date . 

 

admin11_1-1659341748750.png

 

 

 

 

Hope you can help to take a look where go wrong ?

 

Paul

 

 

@admin11 
It should be a measure not a calculated column. 

@tamerj1 

 

Apprecaite your help, Thank you very much. Since today 1 Aug , i don;t have any data in yet , so i am not able to test the expression it is working fine.

 

By the way i just like to know that , if i need to dynamic filter last 2 month ago data off :-

FLAG_DYNAMIC_DATE1 = IF ( Month ( MAX ( 'Date'[Date] ) ) < MONTH ( TODAY ( ) -0), 1 )
FLAG_DYNAMIC_DATE1 = IF ( Month ( MAX ( 'Date'[Date] ) ) < MONTH ( TODAY ( ) -1), 1 )
FLAG_DYNAMIC_DATE1 = IF ( Month ( MAX ( 'Date'[Date] ) ) < MONTH ( TODAY ( ) -2), 1 )
 
Meaning , assume now is Aug , i want to filter off Aug and July.
 
I have try above expression , it does not work.

 

Paul

 

@admin11 

While doing such calculations please pay attention to the year as well. If today is for example Jan 15 then the previous month do not equal 1 -1 = 0 or the month before 1 - 2 = -1. In this case you need to have a year-month sequential number column in your date table. Which is a dense ranking of the year-month number. Then we can comfortably use this column to retun the n previous months. 

@tamerj1 

Thank you for supper fast response. I she'll wait for Aug data come in . From you reply you mention that I need to make use YrMth field . Can you pls share the expression with me .

@admin11 

I will soon as I return to office 

amitchandak
Super User
Super User

@admin11 , Create a new column in the date table

 

if([Date] >= (eomonth([Date], -1*Month([Date])) + 1) && [Date] <= eomonth([Date],-1) ,1,0)

@amitchandak 

i Have try your expression.

when i activated , it will filter off all date.

admin11_2-1659342000126.png

 

 

Hope you can give me advise.

 

Paul

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

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.