March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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]))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
90 | |
90 | |
66 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |