Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Greetings,
i want to use if statement in power bi, but i way i'm using it, doesn't achieve the derired.
i want to count the number of new orders for today. if blank return "No New Orders", if true return count(ord_num)
i tried to create a new column:
Solved! Go to Solution.
hI @rawandshoraa ,
Did you try to create a calculated column? My syntax works for measures only 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
hI @rawandshoraa ,
Did you try to create a calculated column? My syntax works for measures only 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Thank you 🙂
Hi @rawandshoraa ,
I would probably write something like this. Note, I assumed you have a Date dimension called 'DATES'
no_ords =
VAR _OrdersToday =
CALCULATE (
COUNT ( ords[ORD_NUM] ),
DATES[Date] = TODAY()
)
RETURN
IF ( _OrdersToday > 0, _OrdersToday, "No New Orders" )
Let me know if this helps!
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Greetings
appritiate your help,
i tried your solution, it gives the following:
Expressions that yield variant data-type cannot be used to define calculated columns.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 11 | |
| 11 | |
| 9 | |
| 8 | |
| 8 |
| User | Count |
|---|---|
| 30 | |
| 28 | |
| 20 | |
| 16 | |
| 15 |