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.
I Want to learn how to write dax code in two ways ( Calculated Column and Measure)
to formulate total by "PriodID" and "Ratio"
Solved! Go to Solution.
Hi @MrDarian ,
Check
Measure 1 = CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
Measure 2 = SELECTEDVALUE('Table'[Indicator])/[Measure 1]
Column 1 = CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
Column 2 = 'Table'[Indicator]/'Table'[Column 1]
Best Regards,
Jay
Hi @MrDarian ,
Check
Measure 1 = CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
Measure 2 = SELECTEDVALUE('Table'[Indicator])/[Measure 1]
Column 1 = CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
Column 2 = 'Table'[Indicator]/'Table'[Column 1]
Best Regards,
Jay
Hi @MrDarian :
PFB Calculated column and measure :
CalculatedColumnSum = CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
CalculatedColumRatio =
Var _IndicatorByPeriod= CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
Var _Result= DIVIDE('Table'[Indicator],_IndicatorByPeriod,0)
Return
_Result
MeasureSum = CALCULATE(SUM('Table'[Indicator]),ALLEXCEPT('Table','Table'[PeriodID]))
MeasureRatio = DIVIDE(SUMX(FILTER('Table','Table'[PeriodID]=MAX('Table'[PeriodID])),'Table'[Indicator]),[MeasureSum],0)
Thanks!
Try
New column = divide([indicator], sumx(filter(table,[PriodID] = earlier([PriodID])),[indicator]))
New measure = divide(sum([indicator]), sumx(filter(allselected(table),[PriodID] = Max([PriodID])),[indicator]))
New measure = divide(sum([indicator]), sumx(filter((table),[PriodID] = Max([PriodID])),[indicator]))
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 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |