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
ROG
Responsive Resident
Responsive Resident

Total amount by day

Hi all,

 

I have the amount by month, but I need to have the amount by week too. So I thought creating a measure that gives me the daily amount so I could have a line chart showing the amount by month with the ability to drill down by weeks.

Can you help me with a dax measure that gives the total amount by day?

 

You can see the something is wrong with my measure as I'm the values by the 1st week of each month only.

ROG_0-1660256970653.png

 

 

Daily Amount =
VAR _Day_In_Context =
COUNTROWS( 'Calendar' )

VAR _Days_In_Month =
CALCULATE( COUNTROWS( 'Calendar' ) ,
    ALL( 'Calendar' ) ,
    VALUES( 'Calendar'[Month Year] ) )

VAR _Total_Amounts =
CALCULATE( SUM( Amount_2022[Budget] ) ,
    TREATAS( VALUES( 'Calendar'[Month Name Long] ) , Amount_2022[Month] ) )

VAR _Daily_Amount =
IF( HASONEVALUE( 'Calendar'[Date] ) ,
    DIVIDE( _Day_In_Context , _Days_In_Month) * _Total_Amounts ,
    _Total_Amount )

VAR _Results =
SWITCH( TRUE() ,
    ISINSCOPE( 'Country'[Country Name] ) , BLANK() ,  
    ISINSCOPE( 'Customer Category'[Customer Category Name] ) , _Daily_Amount,
_Daily_Amount )

RETURN
_Results
 
 
Thanks!
2 REPLIES 2
amitchandak
Super User
Super User

@ROG , refer if my blog can help

Distributing/Allocating the Monthly Target(Convert to Daily Target): Measure ( Daily/MTD): https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Monthly-Target-...

ROG
Responsive Resident
Responsive Resident

Thansk @amitchandak 

I've tried this, but it's not shwoing any values by days, only by the 1st day of the month. Why is that?

ROG_1-1660298181645.png

 


Date comes from my Calendar table and below is the budget table.

ROG_2-1660298315514.png

 



Below is my model.

ROG_0-1660297941655.png

 

Daily BudgetChurn = CLOSINGBALANCEMONTH(sum(Budget_Churn_2022[Budget Churn])/(maxx(Budget_Churn_2022,DATEDIFF(Budget_Churn_2022[MonthStart],Budget_Churn_2022[MonthEnd],day))+1),'🔎Calendar'[Date])

MTD BudgetChurn = CLOSINGBALANCEMONTH(sum(Budget_Churn_2022[Budget Churn])/(maxx(Budget_Churn_2022,DATEDIFF(Budget_Churn_2022[MonthStart],Budget_Churn_2022[MonthEnd],day))+1),'🔎Calendar'[Date]) *TOTALMTD(COUNT('🔎Calendar'[Date]),'🔎Calendar'[Date])


Thank you so much!

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.