Announcements
cancel
Showing results for
Did you mean:
Contributor III

## Using p() in set analysis when having Multiple Tables and 2 Month Fields

Hi Guys,

I am a little stuck here and hope you can help me out with a set analysis issue.

I would like to incorporate Budget and Profit figures in one table in the front end of the app using set analysis.

My Data model is as below:

What I want to do is to have a table like this, however as you can see the Budget figures give me a sum for the whole year in every month line:

In my set analysis I have the following and technically it should work, but it doesn't:

Sum({\$< [Budget Year] = p(Year), [Budget Month] = p(Month)>}[Budget])

Any advice or ideas would be very much appreciated

1 Solution

Accepted Solutions
Partner - Champion

ex.

Budget:

...

[Budget Date] as Date

From ...

Insurance:

...

Office as [Office Budget]

From ...

I hope it helps.

8 Replies
Partner - Master III

did you check the data types for both month fields

Contributor III
Author

Of course I did, it is in the exact same format. It was the first thing I did.

Partner - Specialist

what does Sum(Budget) return in this table?

Contributor III
Author

The same, Total for the full year for every Month. I think the problem might lie in the Data Model and they way the Tables are interconnected.

Partner - Specialist

Can you join the budget table into the insurance table, and then use a synthetic key, comprising of office and date?

Master II

Maybe use

Sum({\$< [Budget Year] = p([Budget Year]), [Budget Month] = p([Budget Month])>}[Budget])

p(Year) or p(Month) would take all the possible stuff

Since your calendar month, year and budget month, year are different you should use everything from budget table

Unless you map your Date to calendar

Budget:

trim(date([Budget Date],'YYYYMMDD')) as [DateID],

..

..

... From....

Master Calendar:

trim(date(Date,'YYYYMMDD')) as [DateID],

...

...

From...

This will link your budget directly to Calendar and then your Office would also be mapped to Insurance.

Guess that should work as well

Partner - Champion

ex.

Budget:

...

[Budget Date] as Date

From ...

Insurance: