问题
This is the output I would obtain https://i.stack.imgur.com/er8Du.png This is the sample pbix I have done https://mega.nz/#!lg9GASzR!D861nKR8cFGlm4eNyEa2BTep3ku_M5JjktvITAePmQ4
I would obtain the number of customers for each month with the label defined in the measure
m-mark =
IF([sumlast3months]=3;"Gold";
IF([sumlast3months]=2;"Silver";
IF([sumlast3months]=1;"Bronze";
;BLANK())))
How can I find new customers in each month? I have thought to find them with a groupby for customerid with the min data of buying but this way I find only them that are new in this month. Do you have an idea?
回答1:
You can apply Dynamic Segmentation pattern introduced by Marco Russo.
Overall direction to solve this problem is to create a disconnected table for Segmentation, and handle the slicer on Segmentation in your Total (or any) measure.
You need an additional table for customer segmentation to slice by each label such as "Gold" or "Silver". Segmentation table has a column for the label and the criteria for dynamic segmentation (in this case TotalLast3Months). Criteria is only to be used in measures, so it is recommended to make it hidden.
The model diagram will be looking like this. CustomerSegments table has no relationship with other tables. I have introduced one more additinal Customers dimension table, which holds the unique Customers. This is helpful to keep the measure definition simple, and to improve the performance.
As Segmentation table is a disconnected table, the slicers applied on Segmentation will not be propagated to the Total measure automatically. You need to modify the measure definition so that it evaluates the customer segments dynamically, and shows the Total number for Customers who belongs to currently selected Segment.
Minimal measure definition required for this use case would look like this.
Total by Segment =
IF(
ISFILTERED(CustomerSegments[Segment]),
CALCULATE(
[Total],
FILTER(
Customers,
CALCULATE([Total Last 3 Months]) = SELECTEDVALUE(CustomerSegments[TotalLast3Months])
)
),
[Total]
)
Using the Segmentation dimension and the measure defined above, you will get the desired output.
回答2:
If you want a dynamic label (title for example) you can click on the three vertical dots. Here you can chose a measure (which has to be from type text) as dynamic title. Something like:
= "Report from " & Year(Today())
If you want a dynamic tooltip (when you hoover over the bars) you have to add a new page to your report and chose under Page information > Tooltip (toggle it on)
. Now put a measure in this tooltip page:
= "The value in the chart is " & [YourValueColumn] & " with " & [SomeMeasure]
Enable the tooltip in your chart under Tooltip
and chose your just created tooltip page.
来源:https://stackoverflow.com/questions/58957928/how-can-i-do-a-customer-segmentation-for-month-and-see-the-customer-number-filte