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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX for complex date extraction/count

Hello,

 

Is it possible to have an extraction and/or a count of the dates from this column A in the attached screenshot below, everything replicated in PowerBi? Two desired results are shown, preferably #2.

a) purpose is to extract/count all the dates in the chronological order (in which they are listed anyway in each cell) only for 2022. 
b) There is no clear standard form therefor Power Querry's "Split" cannot be used. Sometimes "_" is the link and pattern, but sometimes there is no "_" between text and the next date.
c) date is always in the dd/mm/yyyy format.

 

tyxanu_0-1674567123525.png

 

Thank you

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

Here's one way to do it in the query editor.  To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkmtKDEw1AciIwMj4/jc/KJUkFC8gYm+gSlIzEgBJKYAElSK1YlWKs7PhaowgusC8WEYKGZoABZWio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TextWithDates = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"TextWithDates", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "DatesList", each List.Transform(List.Split(Text.ToList(Text.Select([TextWithDates], {"0".."9","/"})), 10), each Text.Combine(_, ""))),
    #"Expanded DatesList" = Table.ExpandListColumn(#"Added Custom", "DatesList"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded DatesList",{{"DatesList", type date}})
in
    #"Changed Type1"

 

Once you have the data in this structure, you can just make a matrix visual with Date on columns with count aggregation to get your preferred visual.

 

Pat

Microsoft Employee
Anonymous
Not applicable

Hi,

Can you please guide me step by step?

 

So I have my above attached screenshot as xlsx. I load it into PowerBi. What should I do next in order for me to get a visual in Pbi similar to my "Desired result" from Excel?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.