Measure prevents fields from being selected, and viceversa.

alfranco17

Board Regular
Joined
Apr 14, 2013
Messages
198
Hi.

I have a weird problem. If I add a measure to the values, it prevents me from selecting fields. If I add fields, Excel will not allow me to add the measure to values. And the weirdest thing is that it was working, and then said the original pivot table could not connect and became unusable. No errors in Power Query, Connections or Power Pivot. It is just when I try to add the measure with other fields that it happens. Other measure behave normally. DAX Studio says the measure works. It allows me to drop it to the values and then it does not appear.

We have some documents that apply by a date range to inventory stock and inventory transactions, and there is some overlap in the date ranges. The measure is supposed to show all documents that apply for a certain period.

This is the measure:
Code:
Documents :=VAR __start =
    MIN ( Periods{Start Date] )
VAR __end =
    MAX ( Periods[End Date] )
VAR _Part1 =
    CALCULATE (
        CONCATENATEX ( 'All Transactions','All Transactions'[Document],", "),
        FILTER (
            ALLEXCEPT ( 'All Transactions', Categories[Category], 'Reference'[Reference] ),
            'All Transactions'{Start Date] < __end + 1
                && 'All Transactions'[End Date] >= __start
        )
    )
VAR _Part2 =
  CALCULATE (
            concatenatex ( AllStock, AllStock[Document],", " ),
            FILTER (
                ALLEXCEPT ( AllStock, Categories[Category], 'Reference'[Reference] ),
                AllStock{Entry Date] < __end + 1
                &&  AllStock{Exit Date] >= __start
        )
       )
RETURN
            IF(HASONEVALUE(Periods{Start Date]),IF(AND(_Part1<>"",_Part2<>""),_Part2&", " &_Part1, _Part2&_Part1),BLANK())

Thanks. I hope someone has gone through something similar and figured it out (so they can help me, not like I want everybody to struggle :) ).

Best regards.
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top