Forum Discussion
rawandshoraa
4 years agoFrequent Visitor
if statement
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 t...
- 4 years ago
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/
tackytechtom
4 years agoMost Valuable Professional
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/
- rawandshoraa4 years agoFrequent Visitor
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.