"if statement"
7 TopicsHow to write this IF statement for same date, but different statuses?
Hello, I have the two columns below in the same table. "Cookie Type" is text field and "Baked_Date" is a date value. How can I write the IF statement in DAX for the concept: If the same baked_date for Cookie_type "Chewy" and "Chunky", then "Eat", otherwise "do not eat". I added the "Grape" value to show that there are other values in the dataset that are not relevant. Cookie Type Baked_Date Chewy 03/27 Grape 03/27 Chunky 03/27 Thank you!Solved991Views0likes6CommentsDAX: If () with Group_by on (id) and conditions on other columns
Hi, I have a table of the form: id case status 0 1 xx 0 555 yy 0 125 zz 2 87 yy 2 nn xx And I am trying to code something like the below: for every id if 1 case has status xx and 1 case has status yy, THEN I want yy = xx So the resulting table would be id case status 0 1 xx 0 555 **xx** 0 125 zz 2 87 **xx** 2 nn xx I tried with Column= IF ( MAXX ( FILTER ( 'Table', 'Table'[id] = EARLIER ( 'Table'[id] ) && 'Table'[status] = "xx" ), 'Table'[status] ) = "", "", "xx" ) but that doesn't work as it would transform all the *statuses* per *id* into -xx-. Any help on this? ThanksSolved523Views0likes1CommentHelp with error: DAX comparison operations
Hello, I've been searching this forum for help, but haven't managed to find a solution to my problem. I am trying to create a calculated column called HMG. HMG should equal 1 only if both of the following conditions are met: SAMPLE =1 AND State_Clean = "WA". Otherwise, the value for HMG should equal 0. I'm using the following syntax and getting the following error: HMG = if( Interaction_Table[SAMPLE]=1 & RELATED(Client_Table[State_Clean])="WA",1,0) ERROR: DAX comparison operations do not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values. I would love some help adjusting my syntax to work. SAMPLE is a calculated column so I'm not sure how to tell what type it is, but I'm guessing it's numeric since the values are 1 and 0. I assume State_Clean is a string. Thank you!!Solved896Views0likes2CommentsIF THEN to select particular columns
New to DAX - just started yesterday!!! Im trying to build a table that looks at contact info and shows whether or not we will send them a christmas gift. The address, however, should be their home address unless that is NULL...then we pick the business address. To do the NULL check I just look at the home address city and if there is no value there use the business addres. If anyone can help with the correct syntax I would appreciate it. EVALUATE SELECTCOLUMNS( Contact, Contact[FirstName], Contact[LastName], Contact[Christmas_Gift__c], IF( Contact, [Home_Address__City__s] = BLANK, SELECTCOLUMNS( Contact, "Street", Contact[MailingStreet], "City", Contact[MailingCity], "State", Contact[MailingState], "Zip", Contact[MailingPostalCode] ), SELECTCOLUMNS( Contact, "Street", Contact[Home_Address__Street__s], "City", Contact[Home_Address__City__s], "State", Contact[Home_Address__StateCode__s], "Zip", Contact[Home_Address__PostalCode__s] ) )Solved2KViews0likes9CommentsHelp with IF DAX Measure
Hi, I am new to Power BI and have got stuck when creating a measure. I have a fact table the following columns 'FACT_METRICS'[DATE] 'FACT_METRICS'[ACTUAL] 'FACT_METRICS'[TARGET] I have a dimension table with the following 'DIM_DATE'[DATETIME] 'DIM_DATE'[DAY_MINUS] I am wanting to create a measure than returns the following IF 'FACT_METRICS'[DATE] < 'DIM_DATE'[DATETIME] WHERE 'DIM_DATE'[DAY_MINUS] = "Today" THEN CALCULATE(SUM('FACT_METRICS'[ACTUAL]) - SUM('FACT_METRICS'[TARGET])) ELSE SUM('FACT_METRICS'[TARGET]) Any help is much appreciated, ThanksSolved567Views0likes2CommentsIF Function & Filter Help
The Goal is to have one column that generates "SDR Gen" is the SRD Name and AE Name are not blank, and generate "Self Gen" if the SDR name is blank and the AE Name is not blank. Here are the two formulas I have tried, any tips? SDR Gen = (IF(Opportunity[SDR Name]<> BLANK() && Opportunity[AE Name]<>BLANK(), "SDR Gen"), IF(Opportunity[SDR Name]= BLANK() & Opportunity[AE Name]<> BLANK(), "Self Gen", BLANK())) SDR Gen = (IF(Opportunity[SDR Name]<> BLANK(), "SDR Gen", "Self Gen"), FILTER(Opportunity, Opportunity[AE Name]<> BLANK())) Any suggestions on how to make this work would be greatly appreciated.Solved550Views0likes1CommentDAX if statement query
I have this set up which is currently pulling data from excel. I want the data and words to change when I refresh instead of having to type it out. So I'm using the following for the above box to change the box above to say Increased by or decreased by. The 39.49% is another card which is pulling from data field I have called Total_NDD_WOW. I created the following measure for the wording to change. NDD_IF = IF(sum(Data[Total_NDD_WOW]) <0, "decreased by", "increased by") Problem is, if the %age number is a negative e.g. -39.49%, it still shows as "increased by". It only shows "decreased by" if I swap the wording around in the DAX i.e. NDD_IF = IF(sum(Data[Total_NDD_WOW]) <0, "increased by", "decreased by") Wanted to know the best way to fix this without having to change the code over everytime. Thanks542Views0likes2Comments