Forum Discussion
DAX - difference olny in one column
Difference = var _pre=SUMX(FILTER(ALLSELECTED('Table'),[week]=MAX('Table'[week])-1&&[day]=MAX('Table'[day])),[sum])
var _diff=IF(ISBLANK(_pre),BLANK(),[sum]-_pre)
return _diffIs it possible to change the DAX code to display the difference only in column 36?
- Anonymous2 years ago
Hi lukinfo ,
Based on my testing again, it is impossible to display sum from columns 35 and 36.
Please try the following methods as workaround:
1.Create the measure to calculate.
Difference = VAR pre = SUMX(FILTER(ALLSELECTED('Table'),[week] = MAX('Table'[week])-1 && [day] = MAX('Table'[day])),[su]) VAR SELE = MAX('Table'[week]) RETURN IF(SELE = 36, [su] - pre, BLANK())2.Drag the measure into the table visual.
3.The result is shown below. The difference and per can’t be invisible. Because the difference is measure.
4.Power BI does not support this feature currently. You can also raise a new idea and add the comments there to make the drill through feature that maintain the previously selected row coming sooner.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- AnonymousNot applicable
Hi lukinfo ,
Based on my testing, if drag the sum measure into the values, the matrix don’t display the only column.
Because the difference based on the sum measure, if set the week filter is 36, the difference is incorrect.
Please try the following methods and check if they can solve your problem:
1.Create the measure to calculate.
Difference = VAR pre = SUMX(FILTER(ALLSELECTED('Table'),[week] = MAX('Table'[week])-1 && [day] = MAX('Table'[day])),[su]) VAR SELE = MAX('Table'[week]) RETURN IF(SELE = 36, [su] - pre, BLANK())Perc = VAR pre = SUMX(FILTER(ALLSELECTED('Table'),[week] = MAX('Table'[week])-1 && [day] = MAX('Table'[day])),[su]) VAR SELE = MAX('Table'[week]) RETURN IF(SELE = 36, DIVIDE([su],pre), BLANK())2.Drag the measure into the table visual. Delete the sum measure from the values.
3.The result is shown below.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- lukinfoFrequent Visitor
Thank you very much for your reply. Unfortunately, this does not solve my problem because I also need to display the sum from columns 35 and 36. Exactly as below:
- AnonymousNot applicable
Hi lukinfo ,
Based on my testing again, it is impossible to display sum from columns 35 and 36.
Please try the following methods as workaround:
1.Create the measure to calculate.
Difference = VAR pre = SUMX(FILTER(ALLSELECTED('Table'),[week] = MAX('Table'[week])-1 && [day] = MAX('Table'[day])),[su]) VAR SELE = MAX('Table'[week]) RETURN IF(SELE = 36, [su] - pre, BLANK())2.Drag the measure into the table visual.
3.The result is shown below. The difference and per can’t be invisible. Because the difference is measure.
4.Power BI does not support this feature currently. You can also raise a new idea and add the comments there to make the drill through feature that maintain the previously selected row coming sooner.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.