Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I need to create the following formula in DAX:
excel:
if (column 1="C", column 5-column 7, "Open"
PBI:
Response Time = IF(sr[source]="c", calculate (sr[receiveddate]-sr[closingdate]),"Open"))
Please advise how to do it, I tried many different ways but I keep getting a syntax error (invalid token, line 1, offset 30, 'sr[receiveddate]-sr[closingdate]),"Open")))))
Solved! Go to Solution.
@lc1 can you try follownig, I'm shooting in dark without looking at data model.
Response Time = IF(sr[source]="c", DATEDIFF(sr[receiveddate],sr[closingdate], DAY))
Make sure to add as a column? And I assume datatype for both receivedate and closingdate is date.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@lc1 try this
Response Time = IF(sr[source]="c", DATEDIFF(sr[receiveddate],sr[closingdate], DAY), "Open")
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I get this error:
A single value for column 'receiveddate' in table 'sr' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
@lc1 Are you adding this as a measure or column? The dax I proposed suppose to be a column.
And you might run into another error, we are returning number but in else condition we are returning text, but let's see if we have add this expression as a column.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
It was as a calculated column, but I used the same formula adding a column and it gives me #ERROR
@lc1 can you try follownig, I'm shooting in dark without looking at data model.
Response Time = IF(sr[source]="c", DATEDIFF(sr[receiveddate],sr[closingdate], DAY))
Make sure to add as a column? And I assume datatype for both receivedate and closingdate is date.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Sorry, I accepted the answer but I'm missing the last part of the condition:
like if it is "C", substract Received Date from Closed Day, else, "Open"
@lc1 try this
Response Time = IF(sr[source]="c", FORMAT(DATEDIFF(sr[receiveddate],sr[closingdate], DAY), "####" ), "Open")
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you very much, it worked.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
97 | |
80 | |
66 | |
62 |
User | Count |
---|---|
145 | |
113 | |
105 | |
85 | |
65 |