The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have a software that outputs a value in one or two columns.
I have tried to write my own calculate column but always get an error or all zeros.
At any time if value_1 is 20 or above i need the formula to output a 1.
If there is no value_1 but the value_2 over 20 id also need a 1.
The null values i think are whats causing my errors.
Heres what im hoping for.
Value_1 | Value_2 | Result |
Null | Null | 0 |
15 | 33 | 0 |
20 | null | 1 |
5 | 25 | 0 |
Null | 20 | 1 |
30 | 2 | 1 |
Null | 19 | 0 |
33 | Null | 1 |
23 | 10 | 1 |
null | null | 0 |
hi @PCStrouble
I think i stated the problem wrong? Im in the "transform Data" section and OR is not being accepted. I am trying to create a custom column to achieve the task
Power query editor
hi @PCStrouble
the previous code is for calculated column with DAX.
in Power Query, please try
1) replace all null with 0
2) create a custome column like:
= Table.AddColumn(#"Replaced Value1", "Custom", each if
[Value_1]>=20 or ([Value_1]=0 and [Value_2]>=20)
then 1
else 0)
it worked like:
I am by no means a software engineer, coder, at all good with this
User | Count |
---|---|
14 | |
12 | |
7 | |
6 | |
5 |
User | Count |
---|---|
28 | |
18 | |
13 | |
7 | |
5 |