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
Lund
Frequent Visitor

Dynamic table SUM next 6 months

Hi

I have my table like example:

 

DateQty
2022-11-0122
2022-12-1536
2023-01-241
2023-03-154
[...][...]
2024-01-214
2024-01-235

 

What i need, is a dynamic visual table with sum values next 6 months and a column with all values before actual month and a colm with valuea after 6 months like this:

All Before actual monthDec 22Jan 23Feb 23Mar 23Apr 23May 23All from june 23 and after
2236103009

 

And next month it should be

All Before actual monthJan 23Feb 23Mar 23Apr 23May 23Jun 23All from july 23 and after
581030009

 

How can i solve that?

4 REPLIES 4
Lund
Frequent Visitor

Sorry, I can't format the tables better in my question post 😞

amitchandak
Super User
Super User

@Lund , New column in the date table and measure you need

 


New column = if(eomonth([Date], 0) < eomonth(Today(),0) , "All Month Before actual", format([Date], "mmm-yyyy"))

 

 

 

measure = calculate(sum(Table[Value]), filter(Table, Table[Date] <= eomonth(today(),6)))

Yeah, not a bad soluiton. That works. 😼
But i also need a sum of all after next 6 month.

And the sorting of my column are alphabetich and not by date

 

My result:

bi 10.png

Hi @Lund ,

You can create a measure as below to get the next 6 months values:

Measure =
CALCULATE (
    SUM ( 'table'[value] ),
    FILTER (
        ALLSELECTED ( 'table' ),
        'table'[date] >= TODAY ()
            && 'table'[date] <= EOMONTH ( TODAY (), 6 )
            && 'table'[date] <= SELECTEDVALUE ( 'date'[date] )
    )
)

And which field you are using on the matrix Columns field option? What's the data ype of that field? Is it a Text type? You can refer the following blog to custom sort the field values...

Sort a Column with a Custom Order in Power BI

yingyinr_0-1670233556822.png

 

If the above one can't help you get the desired result, please provide some sample data in your table 'employ' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

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.