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
mlanda
Frequent Visitor

Get all values over a treshhold in a period of time

We have a data usage for cellphones table. And we need to calculate the probability of a user exceeding a 20gb usage per month. I need to traverse the past 3 months and everywhere the " Domestic Data Total " is over 20 it will add to the probability. So if a user has , 5, 21, and 7 gb , the probability is 33%. If its 22,36,7 the probability is 66% and so on. I can get the total of the months and the average but setting up the variable and adding to it using a filter is where im stuck. This is what I have so far:

Spike Probability = CALCULATE(SUM('Query1'[Value]),
	'Query1'[Attribute] IN { "DomesticDataTotal" } , DATEADD(Query1[CycleDateEnd], -3, MONTH))

This just gets the total domestic data in the last 3 months. How do I add that filter and counter to calculate the probability?

Thank you.

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @mlanda,

 

Suppose source table is like:

5.PNG

 

Please refer to belowsteps applied in Query Editor mode.

1.PNG2.PNG3.PNG4.PNG

 

Then, in data view, please add calculated columns:

Total usage per month =
CALCULATE (
    SUM ( Query1[Useage] ),
    ALLEXCEPT ( Query1, Query1[CycleDateEnd].[Month], Query1[user] )
)

Spike Probability =
CALCULATE (
    DISTINCTCOUNT ( Query1[Index] ),
    FILTER (
        ALLEXCEPT ( Query1, Query1[user] ),
        Query1[Index] <= EARLIER ( Query1[Index] )
            && Query1[Index]
                >= EARLIER ( Query1[Index] ) - 2
            && Query1[Total usage per month] > 20
    )
)
    / 3

6.PNG

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @mlanda,

 

Suppose source table is like:

5.PNG

 

Please refer to belowsteps applied in Query Editor mode.

1.PNG2.PNG3.PNG4.PNG

 

Then, in data view, please add calculated columns:

Total usage per month =
CALCULATE (
    SUM ( Query1[Useage] ),
    ALLEXCEPT ( Query1, Query1[CycleDateEnd].[Month], Query1[user] )
)

Spike Probability =
CALCULATE (
    DISTINCTCOUNT ( Query1[Index] ),
    FILTER (
        ALLEXCEPT ( Query1, Query1[user] ),
        Query1[Index] <= EARLIER ( Query1[Index] )
            && Query1[Index]
                >= EARLIER ( Query1[Index] ) - 2
            && Query1[Total usage per month] > 20
    )
)
    / 3

6.PNG

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for your response, that is a very clever way of doing it I appreciate it that you did so much to answer my question. We are currently testing it in our end.

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.