Forum Discussion

tulasi_pbi1988's avatar
7 years ago
Solved

Number Of Days in Quarter

Hello,

 

Could anyone please help me creating a number of days in a quarter.

 

I have a scenario to calculate the sales divided by a number of days in the selected quarter.

 

For Example,

I have the table visual consist of date column, sales amount per each date. Now, I need to create a column to show (Sales Amount/Days in the fiscal quarter).

If the user selects 19Q1 and 19Q3 then the number of days should be 181

For 19Q1 related dates sales amount should be divided by 91(number of days in this quarter)

For 19Q3 related dates sales amount should be divided by 89((number of days in this quarter).

 

Thank you!

 

 

  • Hi  tulasi_pbi1988 ,

     

    Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

     

    Best regards

    Amy

3 Replies

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi tulasi_pbi1988 ,

     

    Assuming the column which contains 19Q1 and 19Q3 is called [Year & Quarter], then you can create measure like DAX below.

     

    Average sales for Quarter= DIVIDE(CALCULATE(SUM(Table1[sale]),FILTER(ALLSELECTED(Table1), Table1[Year & Quarter] =MAX(Table1[Year & Quarter]))) ,CALCULATE(COUNT(Table1[Date]),FILTER(ALLSELECTED(Table1), Table1[Year & Quarter] =MAX(Table1[Year & Quarter]))))

     

    Best Regards,

    Amy

     

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

     

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi  tulasi_pbi1988 ,

     

    Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

     

    Best regards

    Amy