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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

How to Import data only for the current date and current week in power bi ?

Hi Everyone i have received a requirement in which i have to import data from oracle database via Direct querry but the issue is the data should get imported only for the current week and current day how i can acheive it ?

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Ayush_tiwari08 , if you can create a date table having week rank in oracle or a date table in import mode 

 

Then you can have columns and measure like

 

new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

measures
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

@amitchandak  your answer was also correct but i did something like this and it worked 

 

Sql Querry for currnet week data = SELECT APPS.table_name.TRANSACTION_DATE AS DATE1,APPS.table_name.ITEM_NUMBER, FROM APPS.table_name
WHERE (APPS.table_name.TRANSACTION_DATE BETWEEN NEXT_DAY(TRUNC(sysdate-7),'MONDAY') AND TRUNC( sysdate +1) ) ORDER BY DATE1

 

SQL Query for current day data = SELECT APPS.table_name.TRANSACTION_DATE AS DATE1,FROM APPS.table_name WHERE (APPS.table_name.TRANSACTION_DATE >= TRUNC(sysdate)) ORDER BY DATE1

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Ayush_tiwari08 ,

 

Whether the advice given by @amitchandak  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

@amitchandak  your answer was also correct but i did something like this and it worked 

 

Sql Querry for currnet week data = SELECT APPS.table_name.TRANSACTION_DATE AS DATE1,APPS.table_name.ITEM_NUMBER, FROM APPS.table_name
WHERE (APPS.table_name.TRANSACTION_DATE BETWEEN NEXT_DAY(TRUNC(sysdate-7),'MONDAY') AND TRUNC( sysdate +1) ) ORDER BY DATE1

 

SQL Query for current day data = SELECT APPS.table_name.TRANSACTION_DATE AS DATE1,FROM APPS.table_name WHERE (APPS.table_name.TRANSACTION_DATE >= TRUNC(sysdate)) ORDER BY DATE1

amitchandak
Super User
Super User

@Ayush_tiwari08 , if you can create a date table having week rank in oracle or a date table in import mode 

 

Then you can have columns and measure like

 

new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

measures
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors