March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello there BI community!
First time poster here with serious imposter syndrome (pun intended).
I got a database with Transactions table in it. I imported the table to Power BI and I also created a Data table with Year, Month, Week and Day columns (among others), but did not make a relation between the two tables.
Here is a simplified example of the table:
My goal is to show the Price equally distributed into Year, Month, Week or even Day based on Fields parameters.
I have found a solution that is really close to what I want, but this solution divides up the Price not equally (that is, not in a uniform fashion), but as I understand, it takes the days and rolls them up based on the amount of days in the desired periods.
This results in fluctuating Price values, where February will have lower Price because it has fewer days, and longer months have higher Price.
Here is the DAX code for the example I mentioned above, plus the results I am getting.
Price Distribution = SUMX(
VALUES('Date'[Date]),
CALCULATE(
SUMX(
FILTER(
Transactions,
Transactions[PeriodFrom] <= MAX('Date'[Date]) && Transactions[PeriodTo] >= MIN('Date'[Date])
),
DIVIDE(Transactions[Price],
DATEDIFF(Transactions[PeriodFrom], Transactions[PeriodTo], DAY)+1
)
)
)
)
The results using Field parameters on Year, Month and Week level →
Yearly distribution:
Monthly distribution:
Month distribution for the Year 2022 only:
Weekly distribution only in 2022:
The desired outputs should look like this (week output is not here, but I hope the logic is clear) →
Yearly distribution:
Monthly distribution for Year 2022:
If You need more information or have any questions, please don't hesitate to ask.
Thank you in advance community and have a lovely day!
@tharunkumarRTK
Do you mean that this 13 period division would solve the weekly distribution problem?
I don't yet see how this method would solve the monthly distribution problem.
As I see it now, your proposed solution would require that I create a separate measure for the Year / Month level, and another one for the week level.
In that case I don't know how I could have the Field parameters applied as shown in the example in my OP.
Could you elaborate on your proposal?
@xmarkx
I think for your requirement, you should consider using a different logic other than Months. You can divide a year into 13 periods, then each period will have 28 days. This way you will be able to distribute your prices equally.
If the post helps please give a thumbs up
If it solves your issue, please accept it as the solution to help the other members find it more quickly.
Tharun
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |