Help writing a cube function

shophoney

Active Member
Joined
Jun 16, 2014
Messages
281
Hi I'm trying to write a cube function that has just todays sales.

Currently i have a slicer for month and year.

=CUBEVALUE("ThisWorkbookDataModel","[Measures].[SALES TOTAL NET RETAIL]",Slicer_MONTH1,U$6,Slicer_YEAR1)

But I would like to have just today. IE TODAY()

I've tried this but that brings up a date i have to write into the formula.

=CUBEVALUE("ThisWorkbookDataModel","[Measures].[SALES TOTAL NET RETAIL]","[SALES TABLE].[TRANS DATE].&[2017-07-03T00:00:00]")

Any thoughts?

Thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Code:
= CUBEVALUE("ThisWorkbookDataModel",
        "[Measures].[SALES TOTAL NET RETAIL]",
        "[SALES TABLE].[TRANS DATE].&[" & TEXT(TODAY(), "yyyy-mm-ddThh:mm:ss") & "]"
)
 
Upvote 0
Hi I wonder if you have any insight in to how to solve this issue.

I have a cube formula with 3 parts. And if any one of the parts does not have values in it. The formula wont work. I end up with #Value! error.

=CUBEVALUE("ThisWorkbookDataModel","[Measures].[1YR AGO OH RETAIL]",'MONTHLY RECAP'!$B217,"[tblLocation].[loc_code].&[1000]",Slicer_YEAR1,Slicer_MONTH1,Slicer_NAME7)-CUBEVALUE("ThisWorkbookDataModel","[Measures].[1YR AGO RETAIL TRANSFERED]",'MONTHLY RECAP'!$B217,"[TRANSFERS].[loc# to].&[1000]",Slicer_YEAR1,Slicer_MONTH1,Slicer_NAME7)+CUBEVALUE("ThisWorkbookDataModel","[Measures].[1YR AGO RETAIL TRANSFERED]",'MONTHLY RECAP'!$B217,"[TRANSFERS].[loc# created].&[1000]",Slicer_YEAR1,Slicer_MONTH1,Slicer_NAME7)


Thanks
 
Upvote 0
Hi I wonder if you have any insight in to how to solve this issue.

I have a cube formula with 3 parts. And if any one of the parts does not have values in it. The formula wont work. I end up with #Value! error.

=CUBEVALUE("ThisWorkbookDataModel","[Measures].[1YR AGO OH RETAIL]",'MONTHLY RECAP'!$B217,"[tblLocation].[loc_code].&[1000]",Slicer_YEAR1,Slicer_MONTH1,Slicer_NAME7)-CUBEVALUE("ThisWorkbookDataModel","[Measures].[1YR AGO RETAIL TRANSFERED]",'MONTHLY RECAP'!$B217,"[TRANSFERS].[loc# to].&[1000]",Slicer_YEAR1,Slicer_MONTH1,Slicer_NAME7)+CUBEVALUE("ThisWorkbookDataModel","[Measures].[1YR AGO RETAIL TRANSFERED]",'MONTHLY RECAP'!$B217,"[TRANSFERS].[loc# created].&[1000]",Slicer_YEAR1,Slicer_MONTH1,Slicer_NAME7)


Thanks

Try wrapping each CUBEVALUE() function with an N() function. This will convert an empty string (as returned by a CUBEVALUE() function without a value) into a zero.
 
Upvote 0

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

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