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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.