Forum Discussion
hi
Hello,
I have this RFM table
RFM Table =
SUMMARIZE(
'bm_retail_t ssummary',
'bm_retail_t ssummary'[CUSTOMER_CODE],
'bm_retail_t ssummary'[mobile_no],
"R Value", [R value],
"F Value", [F value],
"M Value", [M value (sale)],
"Cell No Value", [Cell No value],
)
here
R value is last invoice date
F value is count of invoice number
M value is quantity purchased
and cell no value is count of mobile number
using these 4 fields i want to create RFM analysis. usially RFM analysis is for
R value is last invoice date
F value is count of invoice number
M value is quantity purchased but i want to use Cell no Value as 4th in 1 RFM table
'bm_retail_t ssummary',
'bm_retail_t ssummary'[CUSTOMER_CODE],
'bm_retail_t ssummary'[mobile_no],
here i cant use Customer_code and Mobile_no column same time. either i have to use
RFM Table =
SUMMARIZE(
'bm_retail_t ssummary',
'bm_retail_t ssummary'[CUSTOMER_CODE],
"R Value", [R value],
"F Value", [F value],
"M Value", [M value (sale)],
"Cell No Value", [Cell No value],
)
or
RFM Table =
SUMMARIZE(
'bm_retail_t ssummary',
'bm_retail_t ssummary'[mobile_no],
"R Value", [R value],
"F Value", [F value],
"M Value", [M value (sale)],
"Cell No Value", [Cell No value],
)
can i use switch or any other function a single RFM table?
thx
6 Replies
- 123abc
Community Champion
In Power BI, you can create a single RFM (Recency, Frequency, Monetary) table that combines data from different columns using the SWITCH or IF function along with calculated columns or measures. Since you want to use "Cell No Value" as the 4th dimension in your RFM analysis alongside "R Value," "F Value," and "M Value," you can create a calculated column or measure to achieve this. Here's how you can do it:
First, create a calculated column for RFMC (Recency, Frequency, Monetary, Cell No) in your 'bm_retail_t ssummary' table:
RFMC =
SWITCH(
TRUE(),
NOT(ISBLANK('bm_retail_t ssummary'[R Value])) && NOT(ISBLANK('bm_retail_t ssummary'[F Value])) && NOT(ISBLANK('bm_retail_t ssummary'[M Value])) && NOT(ISBLANK('bm_retail_t ssummary'[Cell No Value])),
"RFMC",
NOT(ISBLANK('bm_retail_t ssummary'[R Value])) && NOT(ISBLANK('bm_retail_t ssummary'[F Value])) && NOT(ISBLANK('bm_retail_t ssummary'[M Value])),
"RFM",
NOT(ISBLANK('bm_retail_t ssummary'[R Value])) && NOT(ISBLANK('bm_retail_t ssummary'[F Value])),
"RF",
NOT(ISBLANK('bm_retail_t ssummary'[R Value])),
"R",
BLANK()
)This calculated column checks the presence of values in each of the R, F, M, and Cell No columns and assigns a label accordingly.
Now, you can use this "RFMC" calculated column in your visuals and slicers to perform RFM analysis when all four values are present, or switch to the desired RFM analysis when one or more values are missing.
For example, you can create measures for Recency, Frequency, Monetary, and Cell No Value based on the selected "RFMC" category in your visuals.
Remember to adjust your visuals and measures accordingly to accommodate this "RFMC" category.
This approach allows you to create a single RFM table that adapts to the availability of data in the columns and provides you with the flexibility you need in your analysis.
If I answered your question, please mark my post as solution, Appreciate your Kudos
- abc_777
Solution Specialist
I know its bit complex but please help if possible
When i create this table i have to make relation between ssummary table customer_code with RFM Test Table Customer_code as active and ssummary table mobile_no with RFM Test Table mobile_no as inactive
otherwise its not filtering.
and relation is many to many.
RFM Test Table =SUMMARIZE( 'bm_retail_t ssummary','bm_retail_t ssummary'[CUSTOMER_CODE],'bm_retail_t ssummary'[mobile_no],"R Value", [R value],"F Value", [F value],"M Value", [M value (sale)],"Cell No Value", [Cell No value],"Summary Type",SWITCH( TRUE(),ISINSCOPE('bm_retail_t ssummary'[CUSTOMER_CODE]), "Customer Summary",ISINSCOPE('bm_retail_t ssummary'[mobile_no]),IF(ISINSCOPE('bm_retail_t ssummary'[CUSTOMER_CODE]),"Mobile No Summary", "Mobile No Summary using Inactive Relationship" ), "Other" ) )i want to make a many to one relation between ssummary table with RFM test Table with either Customer_code or Mobile_no and want to filter RFM by Customer_Code in one chart and RFM by Mobile_no in another chart.thx- 123abc
Community Champion
To create a many-to-one relationship between your 'ssummary' table and the 'RFM Test Table' using either 'Customer_Code' or 'Mobile_no,' and then filter RFM by 'Customer_Code' in one chart and RFM by 'Mobile_no' in another chart, you can follow these steps:
Create a new relationship using 'Customer_Code':
- Create a new calculated column in your 'RFM Test Table' that uses the 'Customer_Code' from 'ssummary.' Name it something like 'Related Customer_Code.'
- Create a relationship between the 'Related Customer_Code' column in the 'RFM Test Table' and the 'Customer_Code' column in the 'ssummary' table. Set this relationship as active.
Create a new relationship using 'Mobile_no':
- Create a new calculated column in your 'RFM Test Table' that uses the 'Mobile_no' from 'ssummary.' Name it something like 'Related Mobile_no.'
- Create a relationship between the 'Related Mobile_no' column in the 'RFM Test Table' and the 'Mobile_no' column in the 'ssummary' table. Set this relationship as inactive.
Here's an example of how to create the calculated columns for both relationships in the 'RFM Test Table':
Related Customer_Code =
IF ( HASONEVALUE ( 'ssummary'[CUSTOMER_CODE] ), VALUES ( 'ssummary'[CUSTOMER_CODE] ) )Related Mobile_no =
IF ( HASONEVALUE ( 'ssummary'[mobile_no] ), VALUES ( 'ssummary'[mobile_no] ) )- Create your two charts:
- In one chart, use the 'RFM Test Table'[Related Customer_Code] as the dimension to filter the RFM analysis by 'Customer_Code.'
- In the other chart, use the 'RFM Test Table'[Related Mobile_no] as the dimension to filter the RFM analysis by 'Mobile_no.'
- Make sure to include the 'R Value,' 'F Value,' 'M Value,' and 'Cell No Value' measures in both charts for your RFM analysis.
With these two relationships and calculated columns, you can now filter your RFM analysis by 'Customer_Code' in one chart and by 'Mobile_no' in another chart. The relationships should automatically switch between active and inactive based on your selections.