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
ianboothman84
Helper II
Helper II

Date Period - union

Good Mornng 

 

I am creating a date period selection but need a little help.  So far i have this:

ianboothman84_0-1625131061216.png

but i need three more levels:

1. Today

2. Last week

3. This week

 

this is my current code

 

Date Period =
UNION(
ADDCOLUMNS(
DATESMTD('Combined Data'[His_Calldate]),
"Type", "This Month"
),
ADDCOLUMNS(
DATESYTD('Combined Data'[His_Calldate]),
"Type", "This Year"
),
ADDCOLUMNS(
PREVIOUSYEAR(DATESYTD('Combined Data'[His_Calldate])),
"Type", "Last Year"
),
ADDCOLUMNS(
PREVIOUSDAY(DATESMTD('Combined Data'[His_Calldate])),
"Type", "Yesterday"
),
ADDCOLUMNS(
PREVIOUSMONTH(DATESYTD('Combined Data'[His_Calldate])),
"Type", "Last Month"
),
ADDCOLUMNS(
CALENDAR(MIN(ddate[Date]),MAX('Combined Data'[His_Calldate])),
"Type", "Show All"
),
ADDCOLUMNS(
CALENDAR(MIN(ddate[Date]),MAX('Combined Data'[His_Calldate])),
"Type", "Personalised"
)
)
 
 
 
can anyone help ? 
 
 
1 ACCEPTED SOLUTION
ianboothman84
Helper II
Helper II

Many thanks for your reply, after alot of research i have resolved the above. 

 

the below measure works great:

Date Period =
UNION(
ADDCOLUMNS(
{today()},
"Type", "Today",
"Order", 1
),
ADDCOLUMNS(
{today()-1},
"Type", "Yesterday",
"Order", 2
),
ADDCOLUMNS(
DATESMTD('Combined Data'[His_Calldate]),
"Type", "This Month",
"Order", 3
),
ADDCOLUMNS(
DATESYTD('Combined Data'[His_Calldate]),
"Type", "This Year",
"Order", 4
),
ADDCOLUMNS(
DATEADD(DATESMTD('Combined Data'[His_Calldate]),-1,MONTH),
"Type", "Last Month",
"Order", 5
),
ADDCOLUMNS(
PREVIOUSYEAR(DATESYTD('Combined Data'[His_Calldate])),
"Type", "Last Year",
"Order", 6
),
ADDCOLUMNS(
CALENDAR(MIN('Combined Data'[His_Calldate]),MAX('Combined Data'[His_Calldate])),
"Type", "Show All",
"Order", 7
),
ADDCOLUMNS(
CALENDAR(MIN('Combined Data'[His_Calldate]),MAX('Combined Data'[His_Calldate])),
"Type", "Custom",
"Order", 8
)
)
 

 

 

View solution in original post

2 REPLIES 2
ianboothman84
Helper II
Helper II

Many thanks for your reply, after alot of research i have resolved the above. 

 

the below measure works great:

Date Period =
UNION(
ADDCOLUMNS(
{today()},
"Type", "Today",
"Order", 1
),
ADDCOLUMNS(
{today()-1},
"Type", "Yesterday",
"Order", 2
),
ADDCOLUMNS(
DATESMTD('Combined Data'[His_Calldate]),
"Type", "This Month",
"Order", 3
),
ADDCOLUMNS(
DATESYTD('Combined Data'[His_Calldate]),
"Type", "This Year",
"Order", 4
),
ADDCOLUMNS(
DATEADD(DATESMTD('Combined Data'[His_Calldate]),-1,MONTH),
"Type", "Last Month",
"Order", 5
),
ADDCOLUMNS(
PREVIOUSYEAR(DATESYTD('Combined Data'[His_Calldate])),
"Type", "Last Year",
"Order", 6
),
ADDCOLUMNS(
CALENDAR(MIN('Combined Data'[His_Calldate]),MAX('Combined Data'[His_Calldate])),
"Type", "Show All",
"Order", 7
),
ADDCOLUMNS(
CALENDAR(MIN('Combined Data'[His_Calldate]),MAX('Combined Data'[His_Calldate])),
"Type", "Custom",
"Order", 8
)
)
 

 

 

v-jayw-msft
Community Support
Community Support

Hi @ianboothman84 ,

 

Not very clear, can you show some sample data?

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.