cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hadill
Helper I
Helper I

How to write conditioned DAX

Hi there,

 

I am trying to type a DAX formula that satisfies the following condition:

 

if the 'sales'[sales-number] contains Number, then print 'Sold Out'

and if it is empty, then print 'Ready for Sale'

 

advince thanks for helping.

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,


Like Amit said you can use PQ or if you want a dax solution:

You can achieve this by either checking for blank

IF(SELECTEDVALUE('ALL'[Value])=BLANK(),"Ready for Sale","Sold Out")


Or checking for number: 

IFERROR(
IF(
ISNUMBER(VALUE(max('ALL'[Value]))),"Sold Out"),"Ready for Sale")


Example:
ValtteriN_0-1646031201507.png

 


 



I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,


Like Amit said you can use PQ or if you want a dax solution:

You can achieve this by either checking for blank

IF(SELECTEDVALUE('ALL'[Value])=BLANK(),"Ready for Sale","Sold Out")


Or checking for number: 

IFERROR(
IF(
ISNUMBER(VALUE(max('ALL'[Value]))),"Sold Out"),"Ready for Sale")


Example:
ValtteriN_0-1646031201507.png

 


 



I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@Hadill , create a new column in power query

 


if [Column] =null then "Ready for Sale"
else if Value.Is([Column], Int64.Type) then "Sold Out" else "Other"



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors