Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am trying to get only the last 4 quarters or last 13 weeks that will be using for the Sparkline reference. My only reference of ranking is based on sorting it form highest to lowest. But since this are strings and not numbers, how can I use it using TopN DAX or other code function? Thanks for the help.
Quarters
2020_1
2020_2
2020_3
2020_4
Weeks
2020_01
2020_02
Additional question:
I only want to extract my data from SQL server for every last 5 years in power query for faster loading and refresh. Any idea on this? Thanks!
Hi @kaye123
>> I only want to extract my data from SQL server for every last 5 years in power query for faster loading and refresh. Any idea on this? Thanks!
you can set fitler on date column in Power Query Editor.
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
@kaye123 , you can
For the second option taking into account your column is text:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMog3MFRQitWBckDsWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByEachDelimiter({"_"}, QuoteStyle.Csv, false), {"Column1.1", "Column1.2"}),
#"Added Custom" = Table.AddColumn(#"Split Column by Delimiter", "Custom", each [Column1.1] & Text.End( "0" & [Column1.2], 3 )),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1.2", "Column1.1"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Custom", Int64.Type}})
in
#"Changed Type"
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@kaye123 , Usually if number are sortable we can create rank and use that, In a separate table is best
example
new column in a separate week table
Week Rank RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
measure example
Last 8 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-8 && 'Date'[Week Rank]<=max('Date'[Week Rank])))
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Thanks for this. I was able to create a table with showing specific rankings thanks for that. Now, I need this table to be flexible, in which ranking will depend on what i chose in the slicers or page filters.
I created a measure like this below. but getting error on the scalar value issue.
I plan to use this as my x-axis on the sparklines. only showing last 4 quarters or last 13 weeks. depending on what year i choose from the slicer.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 15 | |
| 13 | |
| 13 |