cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
joep78 Frequent Visitor
Frequent Visitor

Insert value based on different columns

Hi there,

 

I’m relatively new using PBI and hopefully somebody can help me figuring out how to write a DAX statement.

 

My table name is ‘AnswerLine’ and within this table I’ve got a question column (Question) and an answer column (Answer)

I want to do a measure that when a combination of different answers is set on Y, a column (value) will get a value. If the answer is N, there is no action needed.

 

Example:

Question “ONG000.04” = Y & “ONG000.05” = Y then Value = 2

I’ve got 9 different combinations and in total we have 23 different questions.

 

Not sure if anybody can help me out with this input. If more input is needed, please let me know!

 

Thanks in advance for response!

1 ACCEPTED SOLUTION

Accepted Solutions
natabird3 Member
Member

Re: Insert value based on different columns

@joep78 

Maybe try this primitive solution:

Measure = IF(CONTAINS(AnswerLine,AnswerLine[Answer],"Y"),1,0)
Measure 2 = COUNTX(AnswerLine,"Y")
Capture.JPGnew.JPG

View solution in original post

3 REPLIES 3
svoves Regular Visitor
Regular Visitor

Re: Insert value based on different columns

Adding a conditional column in the query editor perhaps?

 

https://support.office.com/en-us/article/add-a-conditional-column-power-query-f2422ed1-f565-4e64-ba3...

 

If this works for you, please mark my answer as sovled. Cheers

natabird3 Member
Member

Re: Insert value based on different columns

@joep78 

Maybe try this primitive solution:

Measure = IF(CONTAINS(AnswerLine,AnswerLine[Answer],"Y"),1,0)
Measure 2 = COUNTX(AnswerLine,"Y")
Capture.JPGnew.JPG

View solution in original post

joep78 Frequent Visitor
Frequent Visitor

Re: Insert value based on different columns

Thanks for your reply, the following solutions based on your answer works for me:

Measure= IF(
AND(
OR(
CONTAINS(BaseORderAnswerLine;BaseORderAnswerLine[answer];"Ja";BaseORderAnswerLine[Question];"ONG000.04");
CONTAINS(BaseORderAnswerLine;BaseORderAnswerLine[answer];"Ja";BaseORderAnswerLine[Question];"ONG000.05"));
CONTAINS(BaseORderAnswerLine;BaseORderAnswerLine[answer];"Ja";BaseORderAnswerLine[Question];"ONG020")
)
;1;0)

 

with this, I have the right meausure output! 

 

 

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors