Can MDX be used for this?

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,717
Hi Team,

I have a Pivot Table report linked up to a data model held in the Power BI Service. OLAP is used for fast querying.

I now need to present some of the data in a slightly different way and I'm wondering if MDX (in Excel) might be the solution.

Below is small example to try to illustrate what I'm trying to do...

Fact table is like this:

ViewMonthSales
A20190110
A20190215
A2019035
A20190420
B2019015
B20190210
B20190315
B2019045

<tbody>
</tbody>

Dimension table is like this:

MonthShort Month
20190101
20190202
20190303
20190404

<tbody>
</tbody>

There is a relationship in place between the 'Month' columns within the data model.

My Pivot Table (Excel) is laid out like this:

Short MonthAB
01105
021510
03515
04205

<tbody>
</tbody>

I want to create a new measure to 'pick out' values from A or B depending on the Short Month. For example, I might want data from A for Short Months 01, 02 and 04, but from B for Short Month 03. So I want a measure that will produce the following:

Short MonthMeasure
0110
0215
0315
0420

<tbody>
</tbody>

I've had a play with the MDX Calculate Measure option, using IIF and AND functions, as well trying CASE WHEN, but I can't quite get the measure to work with both the fields I need it to reference, i.e. 'Short Month' and 'View'.

Is this kind of thing achievable with MDX?

Cheers,

Matty
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,

Update...

I've managed to write a Calculated Measure that returns the following:

Short MonthAB
01100
02150
03015
04200

<tbody>
</tbody>

Which gets me half way there. However, I don't want the 'View' (A, B) split in there - what I want is this:

Short MonthMeasure
0110
0215
0315
0420

<tbody>
</tbody>

But when I take out the A, B context from the Pivot Table, it displays 0 rather than summing those columns:

Short MonthMeasure
010
020
030
040

<tbody>
</tbody>

Anyone got any ideas?

Cheers,

Matty
 
Upvote 0

Forum statistics

Threads
1,214,394
Messages
6,119,263
Members
448,881
Latest member
Faxgirl

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