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
piopol
Frequent Visitor

Reduce table with filter and export to csv

Hi All, 

I am trying to perform some stock history analysis for as few tickers.
What I am facing currently is to reduce and export the table to show only rows from a particular date with 30 days increment for each ticker.
My data is stored here https://drive.google.com/file/d/1v0rf6Au751D8fR-8y1ewPwSnKUgtrE85/view?usp=sharing 
This is what I am targeting:

Date;TICKER;SMA200
02.01.2019;MRNA;$15,33
02.01.2019;MSFT;$101,12

02.02.2019;MRNA;$15,415
02.02.2019;MSFT;$99,26
02.03.2019;MRNA;$15,415
02.03.2019;MSFT;$99,26

......

If a date with value does not exist (bank holiday or weekend) it should take the following date.

I know it should be done with variables and filters, but I am still learning how those things works.


Thank you in advance for any ideas. 

Piotr

 

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @piopol 

 

Sorry I don't understand what is the expected result? What do you mean by "show only rows from a particular date with 30 days increment for each ticker"? What is the particular date? Is it a fixed date or a dynamic date? Do you mean to show the values of the next 30 days after that date? Can you please use some examples to elaborate the expected result?

 

Best Regards,
Community Support Team _ Jing

So I have data for each day for a few tickers. I want to filter it just for a particular date, i.e. each 15th day of the month. The problem is that sometimes the 15th is Saturday or Sunday, or the stock market didn't work (bank holiday or other reason). 
Currently, I am filtering and exporting it manually, checking whether data exist or not. If not, I am taking the next date, if the following date is empty I am taking the date after the next date and so on.

amitchandak
Super User
Super User

@piopol , Create a Rank column on Date

 

Rank = Rankx(Table, [date], ,asc, dense)

 

Then create a measure like this and use that in visual or visual level filter

 

Measure =

var _max = Maxx(allselected(Table), Table[Rank])

return

calculate(sum(Table[SMA200]) , filter(Table, Table[Rank] >= _max -30 && Table[Rank] <=_max))

 

 

or

 

 

Measure =

var _max = Maxx(allselected(Table), Table[Rank])

return

calculate(sum(Table[SMA200]) , filter(all(Table), Table[Rank] >= _max -30 && Table[Rank] <=_max))

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.