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.
Hi, I am trying to write the following excel formulas in DAX:
=SUMIF(O:O;"<="&O2;H:H) ---> sum column H for all values where O is less than or equal to the current O cell.
and
=IF(P2<=SUM(H:H)/10;1;IF(P2<=2*SUM(H:H)/10;2);"") ---> return 1 if P2 is less than or equal to the sum of column H divided by 10, return 2 if P2 is less than or equal to 2 times the sum of column H divided by 10, otherwise leave it blank
Is this possible?
Thanks
Solved! Go to Solution.
Hi @CJHM ,
According to your description, I created some data to show:
Here are the steps you can follow:
1. Create calculated table.
H =
CALCULATE(SUM('Table'[O]),FILTER('Table','Table'[O]<=EARLIER('Table'[O])))
P1 =
SWITCH(
TRUE(),
'Table'[P2]<=DIVIDE(SUM('Table'[H]),10),1,
'Table'[P2]<=DIVIDE(SUM('Table'[H]),10)*2, 2,
BLANK())
2. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @CJHM ,
According to your description, I created some data to show:
Here are the steps you can follow:
1. Create calculated table.
H =
CALCULATE(SUM('Table'[O]),FILTER('Table','Table'[O]<=EARLIER('Table'[O])))
P1 =
SWITCH(
TRUE(),
'Table'[P2]<=DIVIDE(SUM('Table'[H]),10),1,
'Table'[P2]<=DIVIDE(SUM('Table'[H]),10)*2, 2,
BLANK())
2. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you!
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |