Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Problem showing percentage evolution in histogram bars

Hello, I have a table with 2 rows : accounts numbers plus date of contact.

I added a computed column with YEAR(DateContact).

I've made a visual report (grouped histogram) with the Year as axis, and number of Accounts as sum value.

Everything works fine: it shows the number of accounts grouped by year in several bars.

But I'd like to add (by pop-up) the percentage evolution (in number of accounts) for every bar (every year).

The trouble is that I don't know how to code a measure computing the percentage for every year (from precedent year) in the context of the visual report. I mean showing the specifi percentage for every displayed year.

There is not a global date filter (so I cannot use a DATEADD() function).

Any one has an Idea ? 

Thank you very much if you can help.

2 Replies

  • dedelman_clng's avatar
    dedelman_clng
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous -

     

    Is this what you're looking for?

     

    YoY Evolution =
    VAR __ThisYr =
        SELECTEDVALUE ( Accounts[Year of Contact] )
    RETURN
        DIVIDE (
            COUNT ( Accounts[Acct Number] ),
            CALCULATE (
                COUNT ( Accounts[Acct Number] ),
                Accounts[Year of Contact] = __ThisYr - 1
            )
        )
    

     

    If not, please provide sample data and expected results, or a sample pbix file with sensitive data removed.

     

    Hope this helps

    David

  • Anonymous's avatar
    Anonymous
    Not applicable

    dedelman_clng 

     

    YoY calculation is (Value(T) - Value(T-1)) / Value(T-1).