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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
riyajain12345
Frequent Visitor

Need help

i am new to Power Bi please help me to write this code in power bi:

 

COUNT(IF [Closed Date]>=([Run Date]-30)and[Closed Date]<=[Run Date]
THEN [Request Id]
END )/30

2 ACCEPTED SOLUTIONS
v-nuoc-msft
Community Support
Community Support

Hi @riyajain12345 

 

For your question, here is the method I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1713402456332.png

 

Create a measure.

 

Measure = 
    CALCULATE(
        COUNT('Table'[Request ID]), 
        FILTER(
            ALL('Table'), 
            'Table'[Closed Date] >= 'Table'[Run Date] - 30 
            && 
            'Table'[Closed Date] <= 'Table'[Run Date]
        )
    ) / 30

 

 Here is the result. You can adjust the number of decimal places as needed.

 

vnuocmsft_1-1713402565610.png

 

Regards,

Nono Chen

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

ryan_mayu
Super User
Super User

pls provide some sample data and expected output





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

pls provide some sample data and expected output





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




v-nuoc-msft
Community Support
Community Support

Hi @riyajain12345 

 

For your question, here is the method I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1713402456332.png

 

Create a measure.

 

Measure = 
    CALCULATE(
        COUNT('Table'[Request ID]), 
        FILTER(
            ALL('Table'), 
            'Table'[Closed Date] >= 'Table'[Run Date] - 30 
            && 
            'Table'[Closed Date] <= 'Table'[Run Date]
        )
    ) / 30

 

 Here is the result. You can adjust the number of decimal places as needed.

 

vnuocmsft_1-1713402565610.png

 

Regards,

Nono Chen

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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