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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filter Table by Rows

Hi.

 

I have a question for you.

 

I have a Table in Excel with data from 2009 to today (Just monday to friday information). Following is an example of the table:

 

FECHA                                           COLCAP     GrupoArgos

Wednesday, December 23, 20091364.1318980
Thursday, December 24, 20091372.7218900
Friday, December 25, 20091372.7218900
Monday, December 28, 20091365.0618860
Tuesday, December 29, 20091366.3518940
Wednesday, December 30, 20091366.8519000
Thursday, December 31, 20091366.8519000
Friday, January 1, 20101366.8519000
Monday, January 4, 20101374.2819500
Tuesday, January 5, 20101380.4619560
Wednesday, January 6, 20101381.3519780
Thursday, January 7, 20101368.9119980
Friday, January 8, 20101374.7220300
Monday, January 11, 20101374.7220300
Tuesday, January 12, 20101369.5320400
Wednesday, January 13, 20101379.9120900
Thursday, January 14, 20101386.9120980
Friday, January 15, 20101382.5620340

 

What I want is to use that information to Power BI. But I just need the information of the last year, 6 months, 3 months and last 30 days. (Basically I want 4 tables with the timeframes described before). So, when I add new information, those tables can update automatically with those timeframes. As I need to create calculated columns, that's why I need it that way.

 

I appreciate your assistance.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@ChristianJul - Test

Last Year Table = 
  VAR __Today = TODAY()
  VAR __Min = DATE(YEAR(__Today)-1,MONTH(__Today),DAY(__Today))
RETURN
  CALENDAR(__Min,__Today)

Six Month Table =
  VAR __Today = TODAY()
  VAR __EOM = EOMONTH(__Today,-6)
  VAR __Min = DATE(YEAR(__EOM),MONTH(__EOM),DAY(__Today))
RETURN
  CALENDAR(__Min,__Today)

Six Month Table =
  VAR __Today = TODAY()
  VAR __EOM = EOMONTH(__Today,-3)
  VAR __Min = DATE(YEAR(__EOM),MONTH(__EOM),DAY(__Today))
RETURN
  CALENDAR(__Min,__Today)

Thirty Day Table = 
Six Month Table =
  VAR __Today = TODAY()
  VAR __Min = __Today - 30
RETURN
  CALENDAR(__Min,__Today)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@ChristianJul - Test

Last Year Table = 
  VAR __Today = TODAY()
  VAR __Min = DATE(YEAR(__Today)-1,MONTH(__Today),DAY(__Today))
RETURN
  CALENDAR(__Min,__Today)

Six Month Table =
  VAR __Today = TODAY()
  VAR __EOM = EOMONTH(__Today,-6)
  VAR __Min = DATE(YEAR(__EOM),MONTH(__EOM),DAY(__Today))
RETURN
  CALENDAR(__Min,__Today)

Six Month Table =
  VAR __Today = TODAY()
  VAR __EOM = EOMONTH(__Today,-3)
  VAR __Min = DATE(YEAR(__EOM),MONTH(__EOM),DAY(__Today))
RETURN
  CALENDAR(__Min,__Today)

Thirty Day Table = 
Six Month Table =
  VAR __Today = TODAY()
  VAR __Min = __Today - 30
RETURN
  CALENDAR(__Min,__Today)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , Not very clear, you can use relative date slicer to show this kind of information.

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

or you can create rolling measures with ate table

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-3,MONTH))
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

 

Rolling 30 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-30,Day))

Anonymous
Not applicable

Hi. Thank you for your response. However, what I'm looking for is to have a Table of the last year (for example from 9/10/2019 to 9/10/2020). I need it in table (Creating a table not with a measure), because I need to create calculated columns.

 

I need to use 'Create Table' Feature.

 

Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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