-1

I have an Excel Power Pivot Data Model with one table of about 3m entries. In one of my sheets I have multiple slicers that I combine to select entries that fit specific criteria.

I would like to add a column with a value that comes from a cell in the sheet, but only when the entry was part of the selection. For example: when the value in the cell is 1, the selected entries will get "1" in the added column. After that the number in the cell could be set to 2 and a new selection could be made. The new selection will all have "2" in the same added column.

I have been trying to make this work running a macro and DAX, but it can't get it to work. Anyone any ideas?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • We can't answer your question without a [Minimal, Complete and Verifiable Example](https://stackoverflow.com/help/mcve) – Samuel Hulla Jul 27 '18 at 15:51

1 Answers1

0

You can use the VBA I've previously posted at Converting multiple variables into values with excel pivot tables or power pivot to do that. It requires you to make up a 'harvester' PivotTable containing just the columns you want to swap out, so that you can then create a slicer from which to trigger the code.

You can also write a conditional formula in DAX that uses a harvester measure. Something like https://powerpivotpro.com/2012/11/one-slicer-to-control-them-all/ (and plenty of other examples on Google)

jeffreyweir
  • 4,668
  • 1
  • 16
  • 27