Forum Discussion
QlikView Script to PowerBI
- 3 years ago
With MyTable being the table that contains columns Field (text), Resolved (date), and Opened (date):
let AddColumnTicketAge = Table.AddColumn( MyTable, "Ticket_Age", each Duration.Days( if List.PositionOf({"", Text.Upper("Value1"), Text.Upper("Value2")}, Text.Upper([Field]), 1) > 0 then ([Resolved] - [Opened]) else (Date.From(DateTime.LocalNow()) - [Opened]) ), Int64.Type), AddColumnTicketOpenAge = Table.AddColumn( AddColumnTicketAge, "Ticket_Open Age", each Duration.Days( if List.PositionOf({"", Text.Upper("Value1"), Text.Upper("Value2")}, Text.Upper([Field]), 1) > 0 then null else (Date.From(DateTime.LocalNow()) - [Opened])), Int64.Type ) in AddColumnTicketOpenAgeThe Power Query language is called M (for Meshup), not DAX.
With MyTable being the table that contains columns Field (text), Resolved (date), and Opened (date):
let
AddColumnTicketAge =
Table.AddColumn(
MyTable,
"Ticket_Age",
each
Duration.Days(
if List.PositionOf({"", Text.Upper("Value1"), Text.Upper("Value2")}, Text.Upper([Field]), 1) > 0
then ([Resolved] - [Opened])
else (Date.From(DateTime.LocalNow()) - [Opened])
),
Int64.Type),
AddColumnTicketOpenAge =
Table.AddColumn(
AddColumnTicketAge,
"Ticket_Open Age",
each
Duration.Days(
if List.PositionOf({"", Text.Upper("Value1"), Text.Upper("Value2")}, Text.Upper([Field]), 1) > 0
then null
else (Date.From(DateTime.LocalNow()) - [Opened])),
Int64.Type
)
in
AddColumnTicketOpenAge
The Power Query language is called M (for Meshup), not DAX.
- CVR13923 years agoRegular Visitor
Thank you for the quick response. I have repalced from the script "MyTable" with Tickets (my table name) and "Value1" and "Value2" with Resolved and Closed ( Both are values in my field TicketState ) and "Field" with TicketState (my field) but I am getting the following error. Can you please help me with the error?
- Martin_D3 years agoSolution Sage
Looks Like this question requires the other queries as well for Investigation and a screenshot of the query dependencies (at the View ribbon, button Query Dependencies). Or provide a sample file.