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
mirele_aragao
New Member

How to calculate percentage per day as a measure

Hello,

 

I’m new to Power BI and I can’t find out how to solve this problem.

 

I have the following database – called fCustodia.

 

Capturar.PNG

 

I need to calculate the % of shares of an investor per day for each type of share (there are 2 types of shares – “BDR” and “LUX”).

 

The first % I manage to calculate through a column. When I try to do the same for the second type, I get an error (“A circular dependency was detected”).

 

I understand I need to solve the problem by creating a measure. But how do I calculate a % per investor per day?

I was trying something like below:

 

% LUX = SUMX(fCustodia;fCustodia[Shares])/SUMX(filter(fCustodia;fCustodia[Date]=EARLIER([Date]));fCustodia[Shares])

 

I need the denominator to be sum of the shares of that day, not the total of shares of the database.

 

Many thanks,

Mirele

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @mirele_aragao.

 

You can try to use below formula to calculate per day percent, it also allow filter on it.

% LUX =
VAR temp =
    ALLSELECTED ( fCustodia )
RETURN
    DIVIDE (
        SUMX ( FILTER ( temp, [Date] = MAX ( [Date] ) ), [Shares] ),
        SUMX ( temp, [Shares] ),
        0
    )

Notice: this formula not work properly on total row.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Greg_Deckler
Super User
Super User

I think that you could just create a Table visualization and add Date and Type and then Shares. You should then be able to click on the little down arrow for Shares and chose "Show value 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...

It works if I'm showing a general overview of the data. However if I filter by types of investors, for example, then it recalculates and shows a wrong % 

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.