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.
Hi Everyone
I have this tables with my cutomers budget amount month by month.
But i need to split it up in a messaure, so i get the budget day by day, how can i sovle that?
Solved! Go to Solution.
Hi, @Lund,
there are numeros ways to achieve what your are after, depending on your scenario. E.g. is it direct query or import? What does your data model look like? Do you want the budget spread over all days of the month, or just workdays? Should you handle national holidays?
Assuming that you have a date table in your model, and you want to divide the monthly budget by number of workdays in the month, you can create a measure like this:
Daily budget =
VAR _date =
CALCULATE ( SELECTEDVALUE ( DimDate[Date] ) )
VAR _month =
MONTH ( _date )
VAR _year =
YEAR ( _date )
VAR _workdays =
CALCULATE (
COUNTROWS ( DimDate ),
FILTER (
ALL ( DimDate ),
YEAR ( DimDate[Date] ) = _year
&& MONTH ( DimDate[Date] ) = _month
&& WEEKDAY ( DimDate[Date], 2 ) < 6
)
)
RETURN
DIVIDE (
CALCULATE (
SUM ( Budget[Amount] ),
FILTER (
ALLEXCEPT ( Budget, Budget[CustomerNo], Budget[code] ),
YEAR ( Budget[Date] ) = _year
&& MONTH ( Budget[Date] ) = _month
)
),
_workdays
)
Then create a table visual with dates and this measure and you should get something like this:
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi, @Lund,
there are numeros ways to achieve what your are after, depending on your scenario. E.g. is it direct query or import? What does your data model look like? Do you want the budget spread over all days of the month, or just workdays? Should you handle national holidays?
Assuming that you have a date table in your model, and you want to divide the monthly budget by number of workdays in the month, you can create a measure like this:
Daily budget =
VAR _date =
CALCULATE ( SELECTEDVALUE ( DimDate[Date] ) )
VAR _month =
MONTH ( _date )
VAR _year =
YEAR ( _date )
VAR _workdays =
CALCULATE (
COUNTROWS ( DimDate ),
FILTER (
ALL ( DimDate ),
YEAR ( DimDate[Date] ) = _year
&& MONTH ( DimDate[Date] ) = _month
&& WEEKDAY ( DimDate[Date], 2 ) < 6
)
)
RETURN
DIVIDE (
CALCULATE (
SUM ( Budget[Amount] ),
FILTER (
ALLEXCEPT ( Budget, Budget[CustomerNo], Budget[code] ),
YEAR ( Budget[Date] ) = _year
&& MONTH ( Budget[Date] ) = _month
)
),
_workdays
)
Then create a table visual with dates and this measure and you should get something like this:
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |