Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I am defining a measure as below (Code Below).
Revenue For the first month is calculated as Budget Amount($139,000) multiplied by a cost % (8.21% in this case) and is stored in a variable PeriodOneRevRec. The value of the above is $11,408.
For the next month calculation, i need to subract $11,408 (first Month Revenue) from $139,000 (The Budget Amount). I do this in another variable NetBudgetYearOne. The output i was expecting is 127,592 ($139,000 - $11,408) but the output i am getting is $121,706. Measure Code and Picture of the visual is below. I have also identfied the difference between what is displayed when compared to what is expected, but i do not know why this is happening and hence unable to fix the problem. Reques help on this.
RRR Period Measure =
CALCULATE(
VAR Period=
SELECTEDVALUE('MS Calendar'[Month Year]) -- Value for the Respective Period used in a table visual with Month Year column from
the custom calendar First Period Jun 2023. When i return this, the values are correct
VAR CostPerc=
[Actual Cost % To Forecast] -- Measure working fine. Formula is Cost for the month divided by total cost (Cost for the month plus
sum of future costs). When i return this, the values are correct for all month
VAR StartDate=
FORMAT(MIN('Project Master'[Start Date]),"MMM YYYY") -- Jun 2023. When i return this, the value is correct.
VAR BUDGETAMOUNT =
SUM('Project Master'[Fixed Fee/Cap]) -- $139,000. When i return this the value is correct
VAR PeriodOneRevRec =
[RR 1st Period Rev]--,FILTER('MS Calendar',CurrentPeriod=StartDate)) -- $11,408 (8.21% * 139000). Measure and When i return this,
this value is showing correctly.
VAR PeriodTwo=
FORMAT(EDATE(DATEVALUE("1 " & StartDate),1),"MMM YYYY") --Jul 2023. Showing Correctly for Jul 2023
VAR NetBudgetYearOne=IF(Period=PeriodTwo,(BUDGETAMOUNT-PeriodOneRevRec)) -- Should be $127,592 ($139,000 - $11,408)
Output is $121,706 (this is where the problem is)
VAR PeriodTwoRevRec = NetBudgetYearOne * [Actual Cost % To Forecast] -- 12.44% * $121,706: Instead of 127592. The difference
between 127592 and 121706 is 5886 (17293-11408)
Return
NetBudgetYearOne
--IF(Period=StartDate,PeriodOneRevRec,IF(Period=PeriodTwo,PeriodTwoRevRec))
)
The difference of 5886 is $17293 which is (139000*8.21% [Budget Amount * Cost Percent of June 2023-Month One] Less $11408 which is (139000*12.44% [Budget Amount * Cost Percent of Jul 2023-Month Two].
I am relatively new to DAX. I do understand that i have made a mistake somewhere as the output is only reflecting the written code, but i am unable to identify where the problem.
Pls do help.
Regards
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
56 | |
56 | |
38 | |
29 |
User | Count |
---|---|
75 | |
62 | |
45 | |
40 | |
40 |