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

Select day then show period data

Hi all


When User selected the days, the table show this days data plus after 5 days data, is it possible to do that ?

 

for example : user selected 5th April, the table will show the data from 5th April to 12rd April.

 

do I use SQL Command to do that ?

 

philip 

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hello @TTCF ,

Using SQL:

SELECT sum_data
FROM table_name
WHERE date BETWEEN selectvaluedate  AND selectvaluedate +7;

Use the DAX function:

According to your description, I created some data:

v-yangliu-msft_0-1607326678058.png

Here are the steps you can follow:

1. Create measure.

Measure =
var _select =SELECTEDVALUE('Table'[Date])
var _1=
CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[Date]>=_select&&'Table'[Date]<=_select+7))
return _1

2. Result.

v-yangliu-msft_1-1607326678062.png

You can download the PBIX file from here.

If my answer isn't what you need, can you share sample data and sample output in table format? Or a sample of pbix after deleting sensitive data.

Best regards

Liu Yang

If this post helps,then consider Accepting it as the solution to help other members find it faster.

AllisonKennedy
Super User
Super User

@Anonymous Yes this is possible, do you have sample data? Do you have a DimDate table? You can create another table that is not related to your data, and then use DAX. See if this post helps get you what you want: https://blog.enterprisedna.co/show-days-before-or-after-a-selected-date-using-power-bi/

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.