Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Tini-Bee
Frequent Visitor

Unable to apply measure to CALCULATE statement

I want to utilise the CALCULATE MAX and ALL('Date') as follows:

Sum Range Space =

varTest = CALCULATE(MAX([SumRangeSpace1], ALL('Date')))
VAR RangeSpaceCount = CALCULATE(COUNT(' Build_Capacity'[RangeSpace]

 

VAR TotalCount =  CALCULATE(DISTINCTCOUNT('Build_Usage'[ID]), ALL('Date'))

VAR BLANKK = BLANK()

RETURN

    IF (

        (

            ISFILTERED ( 'Hs'[House Name] )

                && RangeSpaceCount = TotalCount

        ),

        [SumRangeSpace1],

        BLANK()

    )

The underlying measure [SumRangeSpace1] is

SumRangeSpace1 = CALCULATE (

    SUM( 'Build_Capacity'[RangeSpace] ),

    TREATAS (

        VALUES ( 'Build_Usage'[ID] ),

        'Build_Capacity'[ID]

    )

)

1 ACCEPTED SOLUTION
Tini-Bee
Frequent Visitor

rectified this issue using 
CALCULATE([SumRangeSpace1], ALL('Date'))

View solution in original post

4 REPLIES 4
Tini-Bee
Frequent Visitor

rectified this issue using 
CALCULATE([SumRangeSpace1], ALL('Date'))

Tini-Bee
Frequent Visitor

@bhanu_gautam 
VAR varTest = CALCULATE(MAX([SumRangeSpace1]), ALL('Date'))  doesn't work

 

error returned is 'The expression refers to multiple columns'

SumRangeSpace =
VAR varTest = CALCULATE(MAX([SumRangeSpace1]), ALL('Date'))
VAR RangeSpaceCount = CALCULATE(COUNT('Build_Capacity'[RangeSpace]))
VAR TotalCount = CALCULATE(DISTINCTCOUNT('Build_Usage'[ID]), ALL('Date'))
VAR BLANKK = BLANK()

RETURN
IF (
ISFILTERED('Hs'[House Name]) && RangeSpaceCount = TotalCount,
varTest,
BLANKK
)

 

AntrikshSharma
Super User
Super User

@Tini-Bee What is the issue here?

bhanu_gautam
Super User
Super User

@Tini-Bee Try using

DAX
SumRangeSpace =
VAR varTest = CALCULATE(MAX([SumRangeSpace1]), ALL('Date'))
VAR RangeSpaceCount = CALCULATE(COUNT('Build_Capacity'[RangeSpace]))
VAR TotalCount = CALCULATE(DISTINCTCOUNT('Build_Usage'[ID]), ALL('Date'))
VAR BLANKK = BLANK()

RETURN
IF (
ISFILTERED('Hs'[House Name]) && RangeSpaceCount = TotalCount,
[SumRangeSpace1],
BLANKK
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.