Forum Discussion
Date Filter
Hi SudhanshuB
This is one way of doing it:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCsnPVdJRMiwuUfBKzFMwMlGK1YlW8kgsKqpUAIqblGQo+CYWwcT9MpOzgaJGlmDhSrBwLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, #"Date of Birth" = _t]),
#"Changed Type" = Table.TransformColumns(Source, {{"Date of Birth", each Date.From(DateTimeZone.From(Text.Select(Text.BeforeDelimiter(_, " "), {"0".."9"}) & " " & Text.BetweenDelimiters(_, " ", " ") & " " & Text.End(_, 2))), type date}}),
#"Added Date Filter" = Table.AddColumn(#"Changed Type", "Date Filter", each if [Date of Birth] < DateTime.Date(DateTime.LocalNow()) then "Past date" else if [Date of Birth] >= Date.StartOfQuarter(DateTime.Date(DateTime.LocalNow())) and [Date of Birth] <= Date.EndOfQuarter(DateTime.Date(DateTime.LocalNow())) then "Due in current quarter" else "Due in " & Text.Combine({Date.ToText([Date of Birth], "yy"), "Q", Text.From(Date.QuarterOfYear([Date of Birth]), "en-US")}), type text)
in
#"Added Date Filter"The result:
Best regards,
Cidcley Barbosa
- SudhanshuB2 years agoNew Member
Thanks ! Its really complicated . Could you help me with a simplified DAX query . Let me reiterate my question again :
I have a requirement where I need the data which are due in current quarter . For example ,AIID Application Name Next DR Scheduled 12345 X 27th Jan 24 43276 Y 02nd Mar 24 86531 Z 8th Mar 24 78856 W 28th Feb 24
Here in the above table it shows the DR date for X is already completed . Now we are in month of February 24 and we have 3 more DRs to be performed . Hence, If someone asks how many DRs are due for current month , it should be 3 . So, I need to dynamically either have a date filter applied or add a measure to achieve .Please suggest .
- CidcleyBarbosa2 years agoAdvocate IV
You can add the 'Date Filter' column in a slicer, select 'Due in current quarter' and, in a visual, add a measure with a simple COUNT.
- SudhanshuB2 years agoNew Member
Thanks ! Its really complicated . Could you help me with a simplified DAX query . Let me reiterate my question again :
I have a requirement where I need the data which are due in current quarter . For example ,AIID Application Name Next DR Scheduled 12345 X 27th Jan 24 43276 Y 02nd Mar 24 86531 Z 8th Mar 24 78856 W 28th Feb 24
Here in the above table it shows the DR date for X is already completed . Now we are in month of February 24 and we have 3 more DRs to be performed . Hence, If someone asks how many DRs are due for current month , it should be 3 . So, I need to dynamically either have a date filter applied or add a measure to achieve .Please suggest .