Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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]))
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 104 | |
| 82 | |
| 72 | |
| 46 | |
| 35 |