Dark Magic IF,AND,OR [DAX]

At the very heart of the secret runes of DAX, where strings of data merge with the darkness of the unknown, lies the power of a spell known as IF().
It is a tool for the chosen ones, those who are able to see the truth in data and make the right decisions among the shifting shadows. But, like any magic, it requires clear conditions, because one wrong word – and the result will be different from what you expected…

IF() spell:

IF(<условие>, <результат_если_истинно>, <результат_если_ложно>)

When the chosen one casts this spell, it tests the condition. If the condition is true, the first outcome descends from the dark skies. But if it is false, another outcome emerges from the depths of the abyss.

IF(‘Sales’[TotalSales] > 5000, "Большая скидка", "Маленькая скидка")

Here IF() collects according to the sales table. If more than 5000 gold coins are sold, the spell rewards “Big Discount”. Otherwise, be content with “Small Discount”.

AND() spell:

But sometimes a simple condition cannot hold the power of a spell. Then a union of dark conditions comes to the rescue – AND()It is an ancient bond that combines two or more conditions into one powerful spell.

AND(<условие1>, <условие2>)

AND() requires all conditions to be true, otherwise the spell will be broken.

IF(AND(‘Sales’[TotalSales] > 5000, ‘Sales’[Profit] > 1000), "Высокая производительность", "Низкая производительность")

If both sales are over 5,000 and profit is over 1,000, the spell will bring “High Productivity”. But if one of the conditions is not met, the result will be “Low Productivity”. Because one weak element – and the magic will not happen.

OR() spell:

But magic often requires flexibility, and in such cases, they turn to a spell OR(). It allows you to choose any of the paths for the spell to work, giving the power of truth to at least one condition.

OR(<условие1>, <условие2>)

OR() will allow the spell to happen if at least one of the conditions is true – be it sales or profit. If both are false, darkness will cover the outcome with “Threshold not reached”.

IF(OR(‘Sales’[TotalSales] > 5000, ‘Sales’[Profit] > 1000), "Превышение порога", "Порог не достигнут")

When the powers of ancient magicians combine, incredible combinations become possible.

IF(AND(‘Sales’[TotalSales] > 5000, OR(‘Sales’[Profit] > 1000, ‘Sales’[Cost] < 3000)), "Оптимально", "Неоптимально")

There is power here AND() and flexibility OR() are combined into a single spell. To reach the “Optimal” state, you not only need to exceed 5000 in sales, but also fulfill one of the conditions: either profit must exceed 1000, or costs must decrease to 3000. Only then will the magic happen.
Now, with these powers, you will be able to manipulate data like ghostly threads, weaving it into reality at your command.

Be sure to save this spell in your reading scroll.
#PBI_M1o

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *