Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I have a text date field in the format of YYYYMMDD. I need to be able to reference just the YYYYMM in a slicer. How can I get this into a slicer?
Thanks
Hi,
There's a couple of ways you can create a format and use in slicer
Calculated Column in Date Table:
Date_New = FORMAT('my_data'[Date], "YYYYMM")M Query in Query Editor:
Date.From(Text.From([Date], "en-US"))
Concatenation for Month Slicer:
Yearmonth = CONCATENATE(YEAR([Date]), MONTH([Date]))
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Proud to be a Super User! | |
Hi,
This custom column in Power Query will work
Date.From(Text.From([DateKey], "en-US")
Ashish, Could you provide an example. I'm not sure I understand the syntax.
Thanks
Hi,
That code simply has to be pasted in the Custom Column window of Power Query.
hello @Anonymous
you need to extract year, month, and day value from that string to create date format YYYY-MM-DD.
this is one way of many ways.
Both DAX and Power Query work same (extract string number).
if you want to use DAX.
Date format DAX =
var _year = LEFT('Table'[Column1],4) //extract year number
var _day = RIGHT('Table'[Column1],2) //extract day number
var _month = RIGHT('Table'[Column1],4)-RIGHT('Table'[Column1],2)
var _monthnum = SUBSTITUTE(_month,RIGHT(_month,2),"") //extract month number
Return
DATEVALUE(CONCATENATE(CONCATENATE(_year&"-",_monthnum&"-"),_day))
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjEwMzRUitWBcAwNDU2VYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}}),
#"Inserted First Characters" = Table.AddColumn(#"Changed Type", "First Characters", each Text.Start(Text.From([Column1], "en-ID"), 4), type text),
#"Inserted Text Range" = Table.AddColumn(#"Inserted First Characters", "Text Range", each Text.Middle(Text.From([Column1], "en-ID"), 4, 6), type text),
#"Extracted First Characters" = Table.TransformColumns(#"Inserted Text Range", {{"Text Range", each Text.Start(_, 2), type text}}),
#"Inserted Last Characters" = Table.AddColumn(#"Extracted First Characters", "Last Characters", each Text.End(Text.From([Column1], "en-ID"), 2), type text),
#"Merged Columns" = Table.CombineColumns(#"Inserted Last Characters",{"First Characters", "Text Range", "Last Characters"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Merged Columns",{{"Date", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Date", "Date Power Query"}})
in
#"Renamed Columns"
dont forget to change data type into date after using DAX or Power Query since both result still in text.
Hope this will help you.
Thank you.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 66 | |
| 64 | |
| 31 | |
| 26 | |
| 26 |