Help writing a cube function

shophoney

Active Member
Joined
Jun 16, 2014
Messages
286
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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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