Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a table and I need to show the data depending upon one column, I am trying to write a measure that will show the number of work items if that colu
Solved! Go to Solution.
Hi @e77948 ,
In Power Query, it's like this:
if somethingIsTrue
then doThis
else if somethingElseIsTrue
then doThisThingInstead
else doThisThing
In DAX, it's like this:
IF(
somethingIsTrue,
doThis,
doThisThingInstead
)
Pete
Proud to be a Datanaut!
Ah, ok, my bad. Text functions don't skip blanks.
Try this one:
if [Tags] = null then "Primary"
else if Text.Contains([Tags], "Secondary") then "Secondary"
else "Primary"
Pete
Proud to be a Datanaut!
Hi @e77948 ,
Sorry for that the information you have provided is not making the problem clear to me.
Can you please share more details (your tables, your problems, the expected output) to help us clarify your scenario? Or try methods provided by @BA_Pete .
Refer to:
How to Get Your Question Answered Quickly - Microsoft Power BI Community
How to provide sample data in the Power BI Forum - Microsoft Power BI Community
Best Regards,
Eyelyn Qin
if Text.Contains([Tags], "Secondary") then "Secondary" else "Primary" or if isBlank([Tags], "Primary")
Hi @e77948 ,
'isBlank' isn't an M language function, it's a DAX function.
If you can describe the behaviour that you're trying to achieve, I can write the correct M code syntax for you.
Pete
Proud to be a Datanaut!
I want the custom column to say "Primary" if the column "Tags", does not contain the word "Secondary", or if the "Tags" column is blank, and I want the new column to say "Secondary" if the "Tags" column, contains the word "Secondary".
Cool. Try this in a new custom column:
if Text.Contains([Tags], "Secondary") then "Secondary" else "Primary"
Based on your requirement, we don't need to specify anyhting for a blank [Tags] value, as we just pass anything that doesn't contain "Secondary" as a "Primary" output.
Pete
Proud to be a Datanaut!
I get errors for the 25 rows that are blank when I use that query,
Ah, ok, my bad. Text functions don't skip blanks.
Try this one:
if [Tags] = null then "Primary"
else if Text.Contains([Tags], "Secondary") then "Secondary"
else "Primary"
Pete
Proud to be a Datanaut!
Hi @e77948 ,
In Power Query, it's like this:
if somethingIsTrue
then doThis
else if somethingElseIsTrue
then doThisThingInstead
else doThisThing
In DAX, it's like this:
IF(
somethingIsTrue,
doThis,
doThisThingInstead
)
Pete
Proud to be a Datanaut!
Please refer to - How to Get your Question Answered Quickly - https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
User | Count |
---|---|
11 | |
7 | |
5 | |
5 | |
4 |
User | Count |
---|---|
16 | |
14 | |
8 | |
6 | |
6 |