Forum Discussion
Anonymous
3 years agoNot applicable
Constant Column for Table Based on Measure
Hello! I am trying to create a table below in Direct Query mode and am struggling with the last step. I am trying to count the number of items in a table based on status and want to have another colu...
- 3 years ago
you mean with measure? you can try to create with two measures with such code:
Count1 = CALCULATE( COUNTROWS( TableName ) ),
Count2 = CALCULATE( COUNTROWS( TableName ), TableName[Status] = "A" )try to plot a Table Visual, with Status column and the two measures.
FreemanZ
3 years agoSuper User
what do you mean by "constant value based on the 'Status' column."?
Anonymous
3 years agoNot applicable
I mean achieving what I'd shown in 'Count 2' column. I need the rows to ignore the row context of 'Status' column except for Status A
- FreemanZ3 years agoSuper User
aha, then try to create a new table with the code below:
Table =ADDCOLUMNS(VALUES( TableName[Status] ),"Count1",CALCULATE( COUNTROWS( TableName ) ),"Count2"CALCULATE( COUNTROWS( TableName ), TableName[Status] = "A" ))- Anonymous3 years agoNot applicable
Thanks!! This worked. Is there a way to acheive this without the use of tables?
- FreemanZ3 years agoSuper User
you mean with measure? you can try to create with two measures with such code:
Count1 = CALCULATE( COUNTROWS( TableName ) ),
Count2 = CALCULATE( COUNTROWS( TableName ), TableName[Status] = "A" )try to plot a Table Visual, with Status column and the two measures.