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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Arranafc19
Helper IV
Helper IV

Percentage Line Chart using Grouping

I am working on creating a line chart for a report , and I am unsure how to model my current dataset to allow me to plot this as required.

 

Currently my dataset is structured like this

 

 Screen Shot 2019-06-10 at 22.20.06.png

 

Dealer

Sale ID(Unique)

Sale Start (Date item went on sale)

Date Sold(Date item actually sold)

Month sold( Difference in months from sale start and date sold)

 

I need to alter my dataset to show the percentage of items that are sold per month number , while using a slicer to filter the start date and the dealer.

 

Can anyone help me with shaping this dataset ?

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Arranafc19 ,

 

Create a calculated table first.

New table = 
FILTER (
    CROSSJOIN (
        ADDCOLUMNS (
            FILTER (
                CALENDAR ( DATE ( 2018, 1, 1 ), DATE ( 2019, 12, 31 ) ),
                DAY ( [Date] ) = 1
            ),
            "Year-Month", FORMAT ( [Date], "MMM YYYY" )
        ),
        Table4
    ),
    (
        YEAR ( [Date] ) > YEAR ( [Sale start] )
            && OR (
                YEAR ( [Date] ) < YEAR ( [Date Sold] ),
                (
                    AND (
                        YEAR ( [Date] ) = YEAR ( [Date Sold] ),
                        MONTH ( [Date] ) <= MONTH ( [Date Sold] )
                    )
                )
            )
            || (
                YEAR ( [Date] ) = YEAR ( [Sale start] )
                    && MONTH ( [Date] ) >= MONTH ( [Sale start] )
                    && OR (
                        YEAR ( [Date] ) < YEAR ( [Date Sold] ),
                        (
                            AND (
                                YEAR ( [Date] ) = YEAR ( [Date Sold] ),
                                MONTH ( [Date] ) <= MONTH ( [Date Sold] )
                            )
                        )
                    )
            )
    )
)

1.PNG

 

Add below measure and corresponding fields from 'New table' into line chart.

percentage =
DIVIDE (
    COUNT ( 'New table'[Sale Id] ),
    CALCULATE (
        DISTINCTCOUNT ( 'New table'[Sale Id] ),
        ALLSELECTED ( 'New table' )
    )
)

2.PNG

 

Best regards,

Yuliana Gu

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

hi @v-yulgu-msft 

 

thank you for the below explanation , however it is not quite what I was looking for.

 

I need to be able to group the month sold column and get a percentage of total sales per month. Not all records have a date sold so the idea is to get a percetnage per month of how many actually sold.

 

The idea for this graph is that I can use the slicer to filter the sale start date, and then my chart would give me a percentage per month sold , from month 1 upwards

 

Hope this makes sense

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors