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.
Hello Experts,
I am trying to divide 2 calculated columns to get the percentage but getting wrong result.
Calculated column1= IF (Table[Version] = "New" && Table[Code] = "ABC" && Table[Year] < 2022, (Value]).
Likewise created column2 and tried
DIVIDE(Calculated column1, Calculated column2) getting wrong values.
I tried creating a New Measure like
Calculated column1= If ( MAX (Table[Version]= "New" && MAX ( Table[Code] = "ABC" && Table[Year]< 2022, SUM(Value) , the value displayed is Blank.
Thanks in advance.
Solved! Go to Solution.
@Kumar_0606 Instead of creating a calculated column for the division, it's better to create a measure. Measures are more dynamic and can handle aggregations better.
DAX
Measure1 = SUM ( Table[CalculatedColumn1] )
Measure2 = SUM ( Table[CalculatedColumn2] )
PercentageMeasure = DIVIDE ( [Measure1], [Measure2], 0 )
If you want to create a measure that sums values based on conditions, you should use the CALCULATE function.
DAX
Measure1 = CALCULATE (
SUM ( Table[Value] ),
Table[Version] = "New",
Table[Code] = "ABC",
Table[Year] < 2022
)
Proud to be a Super User! |
|
@Kumar_0606 Instead of creating a calculated column for the division, it's better to create a measure. Measures are more dynamic and can handle aggregations better.
DAX
Measure1 = SUM ( Table[CalculatedColumn1] )
Measure2 = SUM ( Table[CalculatedColumn2] )
PercentageMeasure = DIVIDE ( [Measure1], [Measure2], 0 )
If you want to create a measure that sums values based on conditions, you should use the CALCULATE function.
DAX
Measure1 = CALCULATE (
SUM ( Table[Value] ),
Table[Version] = "New",
Table[Code] = "ABC",
Table[Year] < 2022
)
Proud to be a Super User! |
|
Thanks Bhanu.
User | Count |
---|---|
69 | |
64 | |
62 | |
55 | |
28 |
User | Count |
---|---|
203 | |
82 | |
65 | |
48 | |
38 |