Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Frequency last months

Hi,

 

I have a table with these columns:

 

Costumer | Date | Month Number | Sale

 

I would like to select an interval of date (slicer) and bring this number:

How many costumers have purchased at least 1 product in 3 differents months in that selected time interval 

 

PS: sorry for my english, i'm brazilian

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Based on your description, you need to create a what-if parameter as slicer.

Take what-if parameter value as the parameter of month interval in the formula.

 

Measure = COUNTROWS (
FILTER (
SUMMARIZE (
'Table',
'Table'[Costumer],
"count_month",  CALCULATE (
    DISTINCTCOUNT('Table'[Year month]),
    DATESINPERIOD (
        'Table'[Date],
        MAX ( 'Table'[Date]),
        - 'Month interval'[Month interval Value],
        MONTH
    )
)
),
[count_month]>=3
)
)

 

Vlianlmsft_0-1638518864380.pngVlianlmsft_1-1638518902630.png

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Count(filter(summarize(Table, Table[Costumer], Table[Month Number], "_1", DistinctCount(Table[Month Number])), [_1] >=3),[Customer])

Anonymous
Not applicable

What do you mean with "_1"? 

Hi @Anonymous ,

 

Based on your description, you need to create a what-if parameter as slicer.

Take what-if parameter value as the parameter of month interval in the formula.

 

Measure = COUNTROWS (
FILTER (
SUMMARIZE (
'Table',
'Table'[Costumer],
"count_month",  CALCULATE (
    DISTINCTCOUNT('Table'[Year month]),
    DATESINPERIOD (
        'Table'[Date],
        MAX ( 'Table'[Date]),
        - 'Month interval'[Month interval Value],
        MONTH
    )
)
),
[count_month]>=3
)
)

 

Vlianlmsft_0-1638518864380.pngVlianlmsft_1-1638518902630.png

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors