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
bdehning
Post Prodigy
Post Prodigy

Using Filter and using in the last 12 months and only want 12 months on Column Chart

I have a simple chart and using Loss Date (Date Field) in Filter to select Relative Date is in the last 12 months for a count measure (Count of Claims + 0 = CALCULATE(DISTINCTCOUNT(LossRun[Claim Number])) +0)

 

But since it is November 26, I am seeing 13 momnths and Nov 2022 and Nov 2023.    

 

What can I add to eliminate the November 2022 and only see only the last actual 12 months.    

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @bdehning ,

 

You can create a calculated column for the rolling number of months. In the sample below, the latest month is month number 1.  You may modify __MAX_DATE to either reference TODAY() or the latest date in your table.

Rolling Month =
VAR __MAX_DATE =
    MAX ( 'Calendar'[Date] )
RETURN
    DATEDIFF ( 'Calendar'[Date], __MAX_DATE, MONTH ) + 1

You can then use this calculated column to filter a visual/page/report.










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

It should worrk as a calculated column. Are you sure you're trying to create a  calc column and not  a measure? Please post a screenshot.










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

5 REPLIES 5
v-xuxinyi-msft
Community Support
Community Support

Hi , @bdehning

 

You can create a measure as follows.

 

Measure = if(DATEDIFF(SELECTEDVALUE('Table'[Date ]), TODAY(), MONTH) < 12, 1 , BLANK())

 

 

Then add the measure to the filter, showing data with a measure of 1.

vxuxinyimsft_2-1701079996670.png

 

Is this the result you expect?

 

 

Best Regards,

Yuliax

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I tried using this measure and it worked for 12 months.  But if I changed the 12 to 24 or 36 and applied it to my filter, I would see 25 or 37 months?

 

Is there a way to allow for other number months than 12?

danextian
Super User
Super User

Hi @bdehning ,

 

You can create a calculated column for the rolling number of months. In the sample below, the latest month is month number 1.  You may modify __MAX_DATE to either reference TODAY() or the latest date in your table.

Rolling Month =
VAR __MAX_DATE =
    MAX ( 'Calendar'[Date] )
RETURN
    DATEDIFF ( 'Calendar'[Date], __MAX_DATE, MONTH ) + 1

You can then use this calculated column to filter a visual/page/report.










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.

I tried to use the measure,  but the DATEDIFF ('Calendar'[Date] will not take a column as it wants a measure? 

  

It should worrk as a calculated column. Are you sure you're trying to create a  calc column and not  a measure? Please post a screenshot.










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.

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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