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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Amir_Meidan
Frequent Visitor

using time intelligence (dates between) inside summarize function

Hello,
I use this formula to generate table where i have for each date and account from the originl table a new column with last 28 days number of conversations.

table =
SUMMARIZE(
AI_AUTO_PILOT_WITH_TICKET_INFO,
DIM_TIME[DATE],
DIM_ACCOUNT[ACCOUNT_ID],
"last_28_conv_account",
CALCULATE(
DISTINCTCOUNT(AI_AUTO_PILOT_WITH_TICKET_INFO[CONVERSATION_ID]),
DATESBETWEEN(
DIM_TIME[DATE],
MIN(DIM_TIME[DATE]) - 28, -- Use MIN(DIM_TIME[DATE]) to get the current row's date context
MIN(DIM_TIME[DATE]) - 1 -- The last day before the current row's date
)
)
)


why does it returns empty when i use it in a table with date and account columns included?
when i switch to today() its working but i want it to be related to filter context of date and be evaluated for each date sepratly.
thank you 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Amir_Meidan ,

 

Here is the modified formula:

table = ADDCOLUMNS(
SUMMARIZE(
AI_AUTO_PILOT_WITH_TICKET_INFO,
DIM_TIME[DATE],
DIM_ACCOUNT[ACCOUNT_ID]),
"last_28_conv_account",
VAR _current='DIM_TIME'[Date]
RETURN
CALCULATE(
DISTINCTCOUNT(AI_AUTO_PILOT_WITH_TICKET_INFO[CONVERSATION_ID]),
'AI_AUTO_PILOT_WITH_TICKET_INFO','AI_AUTO_PILOT_WITH_TICKET_INFO'[DATE]>=_current - 28, -- Use MIN(DIM_TIME[DATE]) to get the current row's date context
'AI_AUTO_PILOT_WITH_TICKET_INFO'[DATE]<_current -- The last day before the current row's date
)
)

The ADDCOLUMNS function was used to add a calculated column to the above formula, and a date variable was created to specify the row context.

 

Result:

vlinhuizhmsft_0-1737009394773.png

 

Best Regards,
Zhu

 

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Amir_Meidan ,

 

Here is the modified formula:

table = ADDCOLUMNS(
SUMMARIZE(
AI_AUTO_PILOT_WITH_TICKET_INFO,
DIM_TIME[DATE],
DIM_ACCOUNT[ACCOUNT_ID]),
"last_28_conv_account",
VAR _current='DIM_TIME'[Date]
RETURN
CALCULATE(
DISTINCTCOUNT(AI_AUTO_PILOT_WITH_TICKET_INFO[CONVERSATION_ID]),
'AI_AUTO_PILOT_WITH_TICKET_INFO','AI_AUTO_PILOT_WITH_TICKET_INFO'[DATE]>=_current - 28, -- Use MIN(DIM_TIME[DATE]) to get the current row's date context
'AI_AUTO_PILOT_WITH_TICKET_INFO'[DATE]<_current -- The last day before the current row's date
)
)

The ADDCOLUMNS function was used to add a calculated column to the above formula, and a date variable was created to specify the row context.

 

Result:

vlinhuizhmsft_0-1737009394773.png

 

Best Regards,
Zhu

 

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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