Forum Discussion

nickbeltran7's avatar
nickbeltran7
Frequent Visitor
2 years ago
Solved

Measure aggregation

I have the following measure in PowerBI: SPACES = (SUM('Properties'[Spaces]'). This measure aims to return the total number of spaces each Id has. Additionally, I have two other columns in two differ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, @nickbeltran7


    Based on the information you gave, I have created two tables

     

     

    Create a New Measure named SPACE.

     

    I'm trying to use your measure and follow your way, and then here's my idea: create another measure, create a virtual table in it, create a virtual table with the id and Month columns using the Cartesian product, and add a new column to this virtual table with [SPACE] as the value. SUMX is then used to calculate the sum of each row. The DAX expression is as follows:

     

    Measure =

    VAR a = ADDCOLUMNS(CROSSJOIN(VALUES('Table'[ID]),VALUES('Properties'[Month])),"Me",[SPACE])

    RETURN

    SUMX(FILTER(a,[ID] in VALUES('Table'[ID])&&[Month] IN VALUES('Properties'[Month])),[Me])

     

     

    Here's my rendering:

     

     

    I hope my ideas can help you.

     

     

    How to Get Your Question Answered Quickly 

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.