Forum Discussion
Compare customer change between two dates from account table
- 3 years ago
Hi , ChrisCBR
For the column , we need the static fields. Due to we can not put the measure on the headers . So we need to create two dimention table.
Here are the steps you can refer to :
(1)We need to click "New Table" to create two tables:
Row = VALUES('Table'[RatingGrade])Column = VALUES('Table'[RatingGrade])(2)Then we need to create two measures:
Expouser 1-1 = var _row =SELECTEDVALUE('Row'[RatingGrade]) var _column = SELECTEDVALUE('Column'[RatingGrade]) var _date1 = SELECTEDVALUE('Date1'[Date1]) var _date2 = SELECTEDVALUE('Date2'[Date2]) var _row_t = FILTER( 'Table' , 'Table'[Date] =_date1 && 'Table'[Defaulted]=1) var _column_t = FILTER('Table','Table'[Date] =_date2 && 'Table'[Defaulted]=0) var _row_customerNumber = MAXX(FILTER(_row_t , [RatingGrade] = _row),[CustomerNumber]) var _column_customerNumber = MAXX(FILTER(_column_t , [RatingGrade] = _column),[CustomerNumber]) var _in_customnumber =INTERSECT( SELECTCOLUMNS(_row_t , "CustomerNumber",[CustomerNumber]) , SELECTCOLUMNS(_column_t , "CustomerNumber",[CustomerNumber])) var _row_value =DISTINCT(SELECTCOLUMNS( FILTER(_row_t , [CustomerNumber] in _in_customnumber ) , "RatingGrade",[RatingGrade])) var _column_value = DISTINCT(SELECTCOLUMNS( FILTER(_column_t , [CustomerNumber] in _in_customnumber ) , "RatingGrade",[RatingGrade])) var _value =SUMX( FILTER( _row_t,[RatingGrade] = _row) , [Exposure]) return IF(_row in _row_value && _column in _column_value && _row_customerNumber=_column_customerNumber, _value , BLANK())Expouser 1-2 = var _row =SELECTEDVALUE('Row'[RatingGrade]) var _column = SELECTEDVALUE('Column'[RatingGrade]) var _date1 = SELECTEDVALUE('Date1'[Date1]) var _date2 = SELECTEDVALUE('Date2'[Date2]) var _row_t = FILTER( 'Table' , 'Table'[Date] =_date1 && 'Table'[Defaulted]=1) var _column_t = FILTER('Table','Table'[Date] =_date2 && 'Table'[Defaulted]=0) var _row_customerNumber = MAXX(FILTER(_row_t , [RatingGrade] = _row),[CustomerNumber]) var _column_customerNumber = MAXX(FILTER(_column_t , [RatingGrade] = _column),[CustomerNumber]) var _in_customnumber =INTERSECT( SELECTCOLUMNS(_row_t , "CustomerNumber",[CustomerNumber]) , SELECTCOLUMNS(_column_t , "CustomerNumber",[CustomerNumber])) var _row_value =DISTINCT(SELECTCOLUMNS( FILTER(_row_t , [CustomerNumber] in _in_customnumber ) , "RatingGrade",[RatingGrade])) var _column_value = DISTINCT(SELECTCOLUMNS( FILTER(_column_t , [CustomerNumber] in _in_customnumber ) , "RatingGrade",[RatingGrade])) var _value =SUMX( FILTER( _column_t,[RatingGrade] = _column) , [Exposure]) return IF(_row in _row_value && _column in _column_value && _row_customerNumber=_column_customerNumber, _value , BLANK())(3)Then we put the fields we need on the visual and we will meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi, ChrisCBR
Thank you for your experience and technical sharing! For the "current exposure of all new default customers in the form of a card", but you mentioned that you don't have a customer number in your visualization, which means that the basis for grouping does not exist, but if you also want to see the values of some new default customers and show them in the measure, I think the only solution is to write measure to place the grouping of your new default customers in the context of measure. If convenient, you can also provide some simple sample data and the expected output you want for us to do some analysis and review to help you confirm whether it is possible to implement this feature in Power BI.
And this situation is very normal in Power BI, Card's calculation filter context is calculated according to the global context by default, and it is normal that the measures put into other visuals before are not applicable, and the way to solve this is to create new measures written according to your logic.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly