Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Can any one advise how i can write script to count the days if it more than 80 days based on the last 2 dates for each category.
Solved! Go to Solution.
Hi @PRABA7385 , Please try these steps
Hi @PRABA7385 , check this, but you should allways provide sample data and expected result!
Before
After
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIyMDLRNTAEIqVYHWQhM10jUzQhc11jA7CQE0TIFEkjQsgCUwhoFppGQyOwWbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Category = _t, Date = _t]),
ChangedType = Table.TransformColumnTypes(Source,{{"Date", type date}}),
GroupedRows = Table.Group(ChangedType, {"Category"}, {{"All", each _, type table}, {"Days", each
[ a = Table.MaxN(_, {"Date"}, 2)[Date],
b = Duration.TotalDays(a{0} - a{1}),
c = if b > 80 then b else null
][c], type table}})
in
GroupedRows
Hi @PRABA7385 ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution we provided for your issue worked for you or let us know if you need any further assistance?
Your feedback is important to us, Looking forward to your response.
Thank You.
Hi @PRABA7385 ,
We noticed we haven't received a response from you yet, so we wanted to follow up and ensure the solution we provided addressed your issue. If you require any further assistance or have additional questions, please let us know.
Your feedback is valuable to us, and we look forward to hearing from you soon.
Thank You.
Hi @PRABA7385 ,
We noticed we haven't received a response from you yet, so we wanted to follow up and ensure the solution we provided addressed your issue. If you require any further assistance or have additional questions, please let us know.
Your feedback is valuable to us, and we look forward to hearing from you soon.
Thank You.
Hi @PRABA7385 ,
Thank you for reaching out to the Microsoft Fabric Community. @dufoq3 , has provided an accurate solution to your query. Thank you, @dufoq3 , for your valuable input.
If you need additional information or any modifications to the solution, please let us know. we're ready to assist you. Additionally, if possible, please provide sample data to help us address your query more effectively.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @PRABA7385 , check this, but you should allways provide sample data and expected result!
Before
After
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIyMDLRNTAEIqVYHWQhM10jUzQhc11jA7CQE0TIFEkjQsgCUwhoFppGQyOwWbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Category = _t, Date = _t]),
ChangedType = Table.TransformColumnTypes(Source,{{"Date", type date}}),
GroupedRows = Table.Group(ChangedType, {"Category"}, {{"All", each _, type table}, {"Days", each
[ a = Table.MaxN(_, {"Date"}, 2)[Date],
b = Duration.TotalDays(a{0} - a{1}),
c = if b > 80 then b else null
][c], type table}})
in
GroupedRows
Hi @PRABA7385 , Please try these steps