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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
SammiP
New Member

Sales Actuals for Month and then a YTD for the Total Column

Hi Community.  Please help

 

I want to have Columns from March - Feb.  Each Month Must Display the Actual Sales for that Month (NOT TOTAL YTD), then the total column must give YTD.  If the user selects April in the month Slicer.  The April column will Have April's Data (NOT CUMULATIVE OR YTD) and in the Total Column the YTD from Mar .

 

Eg. 1

Mar  Apr  May  YTD

10    20     30     60

 

Eg. 2If I select April from the Month Slicer

 

Mar  Apr  YTD

10    20     30    

 

 

See OutCome Hoped.

SammiP_0-1634746195777.png

 

 

 

 

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

Hi @SammiP ,

 

First create a dim date table as below:

Date = VALUES('Table'[Date])

vkellymsft_0-1635144483347.png

Then create a measure as below:

Measure =
IF (
    ISFILTERED ( 'Date'[Date] ),
    IF (
        ISINSCOPE ( 'Table'[Date] ),
        IF (
            MAX ( 'Table'[Date] ) <= SELECTEDVALUE ( 'Date'[Date] ),
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( ALL ( 'Table' ), 'Table'[Date] = MAX ( 'Table'[Date] ) )
            ),
            BLANK ()
        ),
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Date] <= SELECTEDVALUE ( 'Date'[Date] ) )
        )
    ),
    SUM ( 'Table'[Value] )
)

And you will see:

vkellymsft_2-1635144613869.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

 

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @SammiP ,

 

First create a dim date table as below:

Date = VALUES('Table'[Date])

vkellymsft_0-1635144483347.png

Then create a measure as below:

Measure =
IF (
    ISFILTERED ( 'Date'[Date] ),
    IF (
        ISINSCOPE ( 'Table'[Date] ),
        IF (
            MAX ( 'Table'[Date] ) <= SELECTEDVALUE ( 'Date'[Date] ),
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( ALL ( 'Table' ), 'Table'[Date] = MAX ( 'Table'[Date] ) )
            ),
            BLANK ()
        ),
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Date] <= SELECTEDVALUE ( 'Date'[Date] ) )
        )
    ),
    SUM ( 'Table'[Value] )
)

And you will see:

vkellymsft_2-1635144613869.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my reply as a solution!

 

vanessafvg
Super User
Super User

have you created a file yet?   If you import your table in and filter by that column it should do that automatically.  Where are you struggling exactly?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.