Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Everyone
I have a date picker in Power BI and I want to display the sales of each product on the selected day
plus the day before the selected date and the day before yesterday as shown in the image. and each row should display the target of sales met of that product on specific days in colored bullets that is green specifies that my target on a specific date was met and red specifies it was not met and I want to make dates as a header.
Attached the demo data.
Solved! Go to Solution.
Create a Dynamic Table for Custom dates in Power query as follows
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCslPSaxUitWJVopMLS5JLYLxnFLT8otSFZAEYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Day = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Day", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Date", each if [Day] = "Today" then DateTime.LocalNow() else if [Day] = "Yesterday" then Date.AddDays(DateTime.LocalNow(),-1) else if [Day] = "Before Yesterday" then Date.AddDays(DateTime.LocalNow(),-2) else null),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Conditional Column",{{"Date", type date}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type1", "Day", "Day - Copy"),
#"Duplicated Column1" = Table.DuplicateColumn(#"Duplicated Column", "Date", "Date - Copy"),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Duplicated Column1", {{"Date - Copy", type text}}, "en-GB"),{"Day - Copy", "Date - Copy"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged")
in
#"Merged Columns"
This creates a table as follow
Now create a relationship between this Dynamic table and Your Original Date table.
Use Merged Column as Table Headers.
@user_34 Please accept solution , if it helps to solve your issue.
Thanks it worked
Create a Dynamic Table for Custom dates in Power query as follows
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCslPSaxUitWJVopMLS5JLYLxnFLT8otSFZAEYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Day = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Day", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Date", each if [Day] = "Today" then DateTime.LocalNow() else if [Day] = "Yesterday" then Date.AddDays(DateTime.LocalNow(),-1) else if [Day] = "Before Yesterday" then Date.AddDays(DateTime.LocalNow(),-2) else null),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Conditional Column",{{"Date", type date}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type1", "Day", "Day - Copy"),
#"Duplicated Column1" = Table.DuplicateColumn(#"Duplicated Column", "Date", "Date - Copy"),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Duplicated Column1", {{"Date - Copy", type text}}, "en-GB"),{"Day - Copy", "Date - Copy"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged")
in
#"Merged Columns"
This creates a table as follow
Now create a relationship between this Dynamic table and Your Original Date table.
Use Merged Column as Table Headers.
@user_34 Please accept solution , if it helps to solve your issue.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
86 | |
85 | |
66 | |
49 |
User | Count |
---|---|
140 | |
113 | |
106 | |
64 | |
60 |