Forum Discussion

BieBel's avatar
BieBel
Icon for Helper I rankHelper I
1 year ago

Calculated measure by row I cannot get it to work ...

I have to calculate the room surfaces for different room types => RM[RM_CAT] is not BATHROOM or BASEMENT.
I got the measure to 'work' as far as the roomtypes, but I need to (re)group the total surface by building RM[BL].
So I have to add another part to my measure. Alas, I can't get it to work.
Can anyybody please help?

 

 

AREA_T = CALCULATE(
SUM(RM[AREA]),
FILTER(RM,
(RM[RM_CAT] <> "BATHROOM") ||
(RM[RM_CAT] <> "BASEMENT")
))

...

 

12 Replies

  • Hi BieBel 

    I am not sure what exactly you want to achieve as you did not provide a sample data and your expected result from the same but try these:

    AREA_ = 
    CALCULATE (
        SUM ( RM[AREA] ),
        KEEPFILTERS ( NOT RM[RM_CAT] IN { "BATHROOM", "BASEMENT" } )
    )
    
    AREA_BY_BUILDING = 
    CALCULATE ( [AREA_], ALLEXCEPT ( RM, RM[BL] ) )
    

    Please see the attached sample pbix.

     

    Otherwise, please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.

    • BieBel's avatar
      BieBel
      Icon for Helper I rankHelper I

       

       

       

      Hi, thanks ...

      I applied your code, buth both measures return the same numbers (no division by BL_ID)

      I know you requested an excel or Power BI, yet I cannot figure out how to share it here. So I did take snaps. The table in Power BI is called 'RM'. Field names are unchanged.

      • Thejeswar's avatar
        Thejeswar
        Icon for Super User rankSuper User

        Hi BieBel ,
        Snaps will not help.

        You can just copy your excel data and past it here. It will get pasted as text that can be copied and used

         

        Regards,

  • bl_id every building has got it's 4-digit ID
    rm_fl_bl identifies a single room on a single floor in a single building
    rm_type type of room
    area m²
  • bl_idrm_fl_blrm_typearea
    00080008-00-00.05TECHNICAL9,89
    00130013-00-00.05PARKING57,87
    00130013-00-00.07WORKSHOPS170,2
    00130013-00-00.14PARKING31,24
    00130013-00-00.15PARKING32,3
    00130013-00-00.19STAIRS2,15
    00130013-00-00.23STORAGE3,34
    00130013-01-01.01BATHROOM40,37
    00130013-01-01.04BATHROOM13,56
    00130013-01-01.05STORAGE3,73
    00130013-01-01.07STAIRS1,92
    00130013-02-02.01BASEMENT92,79
    00140014-00-00.12TECHNICAL1,58
    00150015-00-00.22TECHNICAL4,31
    00150015-00-00.36TECHNICAL3,49
    00160016-00-00.01PARKING43,2
    00160016-00-00.07PARKING134,87
    00160016-00-00.08PARKING53,89
    00160016-00-00.21BATHROOM45,18
    00160016-00-00.26WORKSHOPS53,21
    00160016-00-00.28OFFICES15,44
    00160016-00-00.34WORKSHOPS660,84
    00160016-00-00.36STORAGE14,73
    00160016-00-00.41STORAGE16,55
    00180018-00-00.01STAIRS3,03
    00180018-00-00.09STORAGE4,47
    00180018-00-00.11RESTAURANT55,27
    00180018-00-00.13STAIRS2,23
    00180018-00-00.14WORKSHOPS262,13
    00180018-00-00.16STAIRS0,98
    00180018-00-00.22STORAGE8,18
    00180018-M01-M01.01STAIRS2,34
    00180018-M01-M01.05PARKING226,49
    00180018-M01-M01.06STAIRS1,39
    00180018-M01-M01.07BATHROOM15,9
    00180018-M01-M01.08BATHROOM32,83
    00210021-00-00.24BATHROOM30,45
  • rm_type(Multiple Items)
      
    Row LabelsSum of area
    00089,89
    0013302,75
    00141,58
    00157,8
    0016992,73
    0018566,51
    0024307,39

      rm_type has been filtered in this pivot

    • Thejeswar's avatar
      Thejeswar
      Icon for Super User rankSuper User

      Hi BieBel ,

      As I understand, you want data in details for all room types except Basement and Bathroom while your total needs to be at bl_id with all rooms considered.

      You can use the below DAX to get it

       

       

      RoomArea = IF(ISINSCOPE(Table1[rm_type]), CALCULATE([TotalArea], FILTER(Table1, AND(Table1[rm_type] <> "BASEMENT", Table1[rm_type]<>"BATHROOM"))), IF(ISINSCOPE(Table1[bl_id]), CALCULATE ( [TotalArea], ALLEXCEPT ( 'Table1', 'Table1'[bl_id] ) )))

       

       

      TotalArea = SUM(Table1[area])

       

       

      If this solves your question, mark it as solution and appreciate with a Kudo !

       

      Regards,

       

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BieBel,

     

    we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
    If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

     

    Regards,
    Vinay Pabbu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi @BieBel,

       

      we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
      If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

       

      Regards,
      Vinay Pabbu

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi @BieBel,

         

        we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
        If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

         

        Regards,
        Vinay Pabbu