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
Syndicate_Admin
Administrator
Administrator

Total cumulated countrows

Hello Community!

I have an "ASSIGNMENT" table of franchises with their dates of entry, I can know how many franchises entered in a certain month, but I need an accumulated for each month

Captura.JPG

I use a measure for total franchises: Total franchises = COUNTROWS(ASSIGNMENT)

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

I have created a simple sample, please refer to it to see if it helps you.

Create two columns first.

MONTH_ = MONTH(Sheet5[date])
YEAR = YEAR(Sheet5[date])

Then create a measure.

Measure =
CALCULATE (
    SUM ( Sheet5[value] ),
    FILTER (
        ALL ( Sheet5 ),
        Sheet5[MONTH_] <= SELECTEDVALUE ( Sheet5[MONTH_] )
            && Sheet5[YEAR] = SELECTEDVALUE ( Sheet5[YEAR] )
    )
)

vpollymsft_0-1653630086481.png

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

I have created a simple sample, please refer to it to see if it helps you.

Create two columns first.

MONTH_ = MONTH(Sheet5[date])
YEAR = YEAR(Sheet5[date])

Then create a measure.

Measure =
CALCULATE (
    SUM ( Sheet5[value] ),
    FILTER (
        ALL ( Sheet5 ),
        Sheet5[MONTH_] <= SELECTEDVALUE ( Sheet5[MONTH_] )
            && Sheet5[YEAR] = SELECTEDVALUE ( Sheet5[YEAR] )
    )
)

vpollymsft_0-1653630086481.png

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

 

sturlaws
Resident Rockstar
Resident Rockstar

Hi,

by using this pattern from datpatterns.com, and assuming you have a date-table/dimension, I believe you can write your measure like this:

Running total = 
VAR LastVisibleDate =
    MAX ( 'Dates'[Month] )
VAR FirstVisibleDate =
    MIN ( 'Dates'[Month] )
VAR LastDateWithSales =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        REMOVEFILTERS ()   
    )
VAR Result =
           IF (
        FirstVisibleDate <= LastDateWithSales,
        CALCULATE (
            sum('Table'[Number of franchises]),
            'Dates'[Month] <= LastVisibleDate 
        )
    )
RETURN
Result

 

You will of course have to adapt this to your model. I have demonstrated the measure in a very simple mockup report here

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.