Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CYParker
Advocate II
Advocate II

Store Calculated Values into table

Hi All,

 

I have a set of raw bank account transaction data. I'd like to generate monthly totals of debits and credits for use in some sort of time series visual.

 

My idea is to have a new table (e.g. below) which is automatically populated with the appropriate data based on calculations from the raw transaction data.

YearMonthTotal ExpenseTotal Debit

 

I currently have a couple of visuals (see below) which show the respective total values, which are filtered with a timeline slicer, and another filter which excludes transactions with certain categories.

CYParker_0-1652507306226.png

 

I'm thinking there must be a way to have the total values populated into the new table without me needing to manually obtain the totals (selecting each month using the timeline and then transcribing the totals displayed in my visuals), but am just starting my journey in Power BI and am not sure where to start.

 

Could anyone give me some ideas or a starting point for me to work form to find a solution for this?

1 ACCEPTED SOLUTION

Hi @CYParker ,

 

I feel like you need a summary table based on your description?

 

You can use the New Table function provide by Power BI via SUMMARIZE( ).

vchenwuzmsft_0-1652858600915.png

For example, the data looks like this:

vchenwuzmsft_1-1652859604799.png

Table expression:

 

Table =
SUMMARIZE (
    'Fact Table',
    [Date].[Year],
    [Date].[Month],
    "Total Expense", SUM ( 'Fact Table'[Expense] ),
    "Total Debit", SUM ( 'Fact Table'[Debit] )
)

 

Result:

vchenwuzmsft_2-1652859676556.png

This expression also works in measure. What's difference between measure and calculate column, please refer this:

Calculated Columns and Measures in DAX - SQLBI

 

When you refresh your data, the new calculation table is recalculated, however, it does not change when you do some interaction with any of the visuals in the report. report can only fetch data from the model(table), it cannot return data. So, you cannot transcribe some values into the model(table) for any interaction you do.

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello @CYParker ,

The simple solution to your problem is that you need to add the 'Year-month' column in your new table instead of the year only so that your data will be calculated for each month automatically. So it will remove your manual work.

Please let me know if you need more help.

Thanks,
Neel

Hi @Anonymous,

 

Could you explain how the data is calculated? 

 

A large part of my question is how to get the Total Expense and Total Income values into the table

Hi @CYParker ,

 

I feel like you need a summary table based on your description?

 

You can use the New Table function provide by Power BI via SUMMARIZE( ).

vchenwuzmsft_0-1652858600915.png

For example, the data looks like this:

vchenwuzmsft_1-1652859604799.png

Table expression:

 

Table =
SUMMARIZE (
    'Fact Table',
    [Date].[Year],
    [Date].[Month],
    "Total Expense", SUM ( 'Fact Table'[Expense] ),
    "Total Debit", SUM ( 'Fact Table'[Debit] )
)

 

Result:

vchenwuzmsft_2-1652859676556.png

This expression also works in measure. What's difference between measure and calculate column, please refer this:

Calculated Columns and Measures in DAX - SQLBI

 

When you refresh your data, the new calculation table is recalculated, however, it does not change when you do some interaction with any of the visuals in the report. report can only fetch data from the model(table), it cannot return data. So, you cannot transcribe some values into the model(table) for any interaction you do.

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi,

 

Thanks for your response and apologies for not replying sooner.

 

I havent tried your solution as yet, but it definitely looks like it's what I'm looking for. Once I get time to try it out I'll report back.

 

Cam.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.