Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
hello , please i need some help here what i have
if ( ca = 0 ) in date1 and ca <>0 in date2 then 'new'
else if ( ca in date1 < ca in date2 ) then 'up')
else if (ca in date 1 > ca in date then 'down')
else if ca <> 0 in date1 and ca = 0 in date 2 then 'unkhnown')
so i try to write it with dax like this
if ( (ca=0 , date1 ), 'nouveaux' , if(ca <>0 , date2), 'nouveaux', if ((ca , date1 )<(ca , date2), 'croissance', if ((ca , date1 )>(ca , date2), 'perte',if((ca<>0 , date1 ), (ca =0 , date2),'null')))))
or
if ( (ca=0 , date1 ) && (ca <>0 , date2); 'nouveaux'; if ((ca , date1 )<(ca , date2); 'croissance'; if ((ca , date1 )>(ca , date2) ; 'perte' ; if((ca<>0 , date1 )&&(ca =0 , date2);'null')))))
I have a problem to acces to power BI so until i found a solution i want to be sure that my dax querry is right .
Any suggestion please
thank you
Solved! Go to Solution.
Hello, Switch should be perfect.
I assume two measures,
CA1 for ca in date1 and CA2 for ca in date2.
Switch(
TRUE(),
[CA1]=0 && [CA2]<>0, 'new', --condition 1
[CA1]>[CA2], 'up', --condition 2
[CA1]<[CA2], 'down' --condition 3
[CA1]<>0 && [CA2]=0, 'unknown' --condition 4
BLANK()) --else
For further information check this article.
I hope this helps. I want miss the SWITCH function anymore.
Hello, Switch should be perfect.
I assume two measures,
CA1 for ca in date1 and CA2 for ca in date2.
Switch(
TRUE(),
[CA1]=0 && [CA2]<>0, 'new', --condition 1
[CA1]>[CA2], 'up', --condition 2
[CA1]<[CA2], 'down' --condition 3
[CA1]<>0 && [CA2]=0, 'unknown' --condition 4
BLANK()) --else
For further information check this article.
I hope this helps. I want miss the SWITCH function anymore.
thank you it work but i have juste a little problem i want to regroup my data by criterion . so i want to have those criterion in line and CA1 and CA2 in column ; the problem that power consider it as a measure so it automatically put it in colunm what ken i do please
Do you have several rows per Code Client?
i didn't understand what do you mean by several rows but here what i want to do in first place
after that i want to drill down in detail and display the client that belong to each class of new / up / down / vide
Hello,
I understand your desired output perfectly.
How does your row data look like?
Best regards
mntper1 and mntper2 are amount so they are number but seg client is a switch function that i create in a measure by your help
seg_client = Switch( TRUE(); [MntPer1] = 0 && [MntPer2]<>0; "new"; --condition 1
[MntPer1]<[MntPer2]; "up"; --condition 2
[MntPer1]>[MntPer2]; "down" ; --condition 3
[MntPer1]<>0 && [MntPer2]=0; "unknown" ; --condition 4
BLANK()) --else
and it's a text according to power bi
Did you erse the '--condition x' ? They were just for information and not meant to be part of the formula.
Calculated column should be:
= Switch( TRUE(); [MntPer1] = 0 && [MntPer2]<>0; "new";
[MntPer1]<[MntPer2]; "up";
[MntPer1]>[MntPer2]; "down" ;
[MntPer1]<>0 && [MntPer2]=0; "unknown" ;
BLANK())
yes i khnow it's just a comment "-- condition" it doesn't affect the formula
Hello,
try to create a calculated column with this formula.
he doesn't accept the switch in it 😕
Hello, try to use the columns names instead of CA1 and CA2.
Best regards.
CA1 and CA2 are measure that i created in power bi to use them
Can you post an example of your data? I don't understand ca=0 in date1?
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
i have problem to access to my data but 'CA' it's a measure ; an amount and date1 is a date from Dimension date that's why i called date1 because i have with 2 date that's why
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |