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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PowerAutomater
Advocate II
Advocate II

Can a single measure have multiple calculations (add, divide, filter etc) in it?

I am trying to work if it is possible to do some caluclations without the needing multiple measures.

For example if I have 2 measures like this:

Measure1 = CALCULATE(DISTINCTCOUNT('Table'[field1]),FILTER('Table',not(ISBLANK('Table'[field1]))))

Measure2 = CALCULATE(DISTINCTCOUNT('Table'[field2]),FILTER('Table',not(ISBLANK('Table'[field2]))))

 

And I need to add the total of these 2 measures together (Measure1 + Measure2). I know I can create a third measure to achieve this, but my question is is there a way to complete the above calculation in a single measure rather than needing to create 3, since it seems a little unnecessarily messy?

1 ACCEPTED SOLUTION
pankajnamekar25
Super User
Super User

Yes, a single DAX measure can include multiple calculations like CALCULATE, FILTER, DISTINCTCOUNT, and arithmetic operations. You don't need separate measures if you're only using them once. You can combine the logic directly into one measure to keep things cleaner and more efficient using variable

 

Like this

Measure=

CALCULATE(

    DISTINCTCOUNT('Table'[field1]),

    FILTER('Table', NOT(ISBLANK('Table'[field1])))

)

+

CALCULATE(

    DISTINCTCOUNT('Table'[field2]),

    FILTER('Table', NOT(ISBLANK('Table'[field2])))

)

 

 

Thanks

 Pankaj Namekar | LinkedIn

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

View solution in original post

3 REPLIES 3
V-yubandi-msft
Community Support
Community Support

Hi @PowerAutomater ,

Thank you for reaching out. @pankajnamekar25  & @Jihwan_Kim  has provided a response that matches your requirement. Please review and try the suggested solution.

If you need any additional information or further assistance, please let us know. we are ready to help.

Thank you for your valuable insight's @Jihwan_Kim , @pankajnamekar25 .

 

— Yugandhar
Community Support Team.

 

pankajnamekar25
Super User
Super User

Yes, a single DAX measure can include multiple calculations like CALCULATE, FILTER, DISTINCTCOUNT, and arithmetic operations. You don't need separate measures if you're only using them once. You can combine the logic directly into one measure to keep things cleaner and more efficient using variable

 

Like this

Measure=

CALCULATE(

    DISTINCTCOUNT('Table'[field1]),

    FILTER('Table', NOT(ISBLANK('Table'[field1])))

)

+

CALCULATE(

    DISTINCTCOUNT('Table'[field2]),

    FILTER('Table', NOT(ISBLANK('Table'[field2])))

)

 

 

Thanks

 Pankaj Namekar | LinkedIn

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

Jihwan_Kim
Super User
Super User

Hi,

Please try something like below.

 

expected result measure: =
VAR _Measure1 =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[field1] ),
        FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[field1] ) ) )
    )
VAR _Measure2 =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[field2] ),
        FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[field2] ) ) )
    )
RETURN
    _Measure1 + _Measure2

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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