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
venkataramana
Regular Visitor

Need a measure for Line chart in Power BI

Hi, I am creating a line chart in Power BI, with 'month name', 'Company' and 'No of transcations' fields.

          1) 'Month name' - it should show all the months for selected year.

               ( Ex: if it is '2021' it should be 'Jan to Aug (current month), if it is '2020', it should be 'Jan to Dec').

          2) Company - It shows all the companies names. Company names may increase or decrease each year.

          3) 'No of transcations' - It shows the number of transactions happend for each company for each year and month.

I need a measure for line chart, and it should divide 100% to all companies for each month. If you are confused with my words, please look at the attached screenshot.

LineChart ex.PNG

 Please help on this.

Thanks in advance. 

 

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

Hi @venkataramana ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

% measure = 
VAR _inditrans =
    SUM ( 'Transactions'[No of transactions] )
VAR _permonthtrans =
    CALCULATE (
        SUM ( 'Transactions'[No of transactions] ),
        FILTER (
            ALLSELECTED ( 'Transactions' ),
            'Transactions'[Date] = SELECTEDVALUE ( 'Transactions'[Date] )
        )
    )
RETURN
    DIVIDE ( _inditrans, _permonthtrans, 0 )

yingyinr_0-1630571883325.png

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.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @venkataramana ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

% measure = 
VAR _inditrans =
    SUM ( 'Transactions'[No of transactions] )
VAR _permonthtrans =
    CALCULATE (
        SUM ( 'Transactions'[No of transactions] ),
        FILTER (
            ALLSELECTED ( 'Transactions' ),
            'Transactions'[Date] = SELECTEDVALUE ( 'Transactions'[Date] )
        )
    )
RETURN
    DIVIDE ( _inditrans, _permonthtrans, 0 )

yingyinr_0-1630571883325.png

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.
Greg_Deckler
Super User
Super User

@venkataramana Drop down the arrow for % measure, choose Show As and then Percent of Grand Total?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.