cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge. Frequent Visitor

## Help me Understand why my Total column isn't working Below is the measure and above is the values table (contracts x Fiscal Year x Cost per FY) My values are all correct -- giving me the \$\$ that each contract will pay during the relavent FYs.

However, the Total column is very wrong. Appears to be giving me conCost / numDays. I would love some support to understand why this is happening and how to fix it.

(Filter FY Range returns 1 for each FY during the Contract date range. Returns blank otherwise)

1 ACCEPTED SOLUTION  Super User

@SELECTEDVALUE returns blank at the total level for most of (if not all) the variables. Even if you change to MAX or MIN the result at the total level will allways be wrong.

``````Cost per FY =
SUMX (
VALUES ( FY[Fiscal Year] ),
CALCULATE (
VAR constart =
SELECTEDVALUE ( contracts[Start] )
VAR conEd =
SELECTEDVALUE ( contracts[End] )
VAR conCost =
SELECTEDVALUE ( contracts[Total Cost] )
VAR numDays =
DATEDIFF ( conStart, conEnd, DAY ) + 1
VAR daysinfy =
DATEDIFF (
MAX ( conStart, CALCULATE ( SELECTEDVALUE ( FY[FY Start] ) ) ),
MIN (
COALESCE ( conEnd, CALCULATE ( SELECTEDVALUE ( FY[FY end] ) ) ),
CALCULATE ( SELECTEDVALUE ( FY[FY end] ) )
),
DAY
) + 1
RETURN
IF ( [Filter Fy Range], daysinfy * conCost / numDays, BLANK () )
)
)``````

2 REPLIES 2  Super User

@SELECTEDVALUE returns blank at the total level for most of (if not all) the variables. Even if you change to MAX or MIN the result at the total level will allways be wrong.

``````Cost per FY =
SUMX (
VALUES ( FY[Fiscal Year] ),
CALCULATE (
VAR constart =
SELECTEDVALUE ( contracts[Start] )
VAR conEd =
SELECTEDVALUE ( contracts[End] )
VAR conCost =
SELECTEDVALUE ( contracts[Total Cost] )
VAR numDays =
DATEDIFF ( conStart, conEnd, DAY ) + 1
VAR daysinfy =
DATEDIFF (
MAX ( conStart, CALCULATE ( SELECTEDVALUE ( FY[FY Start] ) ) ),
MIN (
COALESCE ( conEnd, CALCULATE ( SELECTEDVALUE ( FY[FY end] ) ) ),
CALCULATE ( SELECTEDVALUE ( FY[FY end] ) )
),
DAY
) + 1
RETURN
IF ( [Filter Fy Range], daysinfy * conCost / numDays, BLANK () )
)
)`````` Frequent Visitor

Brilliant, Tysm! Announcements #### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features. #### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator. #### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings. Top Solution Authors
Top Kudoed Authors
Users online (1,920)