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
samue_an
Helper I
Helper I

Calculate % of value occurrences for each date

 

Hi All, wonder if you can help with a Dax solution, I've got 2 columns, 1 date, second Answer, is values that only have 2 variants, I.e Yes or No

I need to transform the data to a date column, %yes column and %no column

Maybe I need to pivot out three 2 columns but cannot figure it out, help will be appreciated

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

  1. Create a Calendar Table and build a relationship from the Date column of the Data Table to the Date column of the Calendar Table
  2. To your visual, drag the Date field from the Calendar Table and Answer field from the Data Table
  3. Write this measure

Measure1 = COUNTROWS(Data)/CALCULATE(COUNTROWS(Data),ALL(Data[Answer]))

Format Measure1 as a %.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi , @samue_an 

Could you please tell me whether your problem has been solved?
If it is,  please mark the helpful replies or add your reply as Answered to close this thread.
More people will learn new things here. If you haven't, please feel free to ask.

Best Regards,
Community Support Team _ Eason

Ashish_Mathur
Super User
Super User

Hi,

  1. Create a Calendar Table and build a relationship from the Date column of the Data Table to the Date column of the Calendar Table
  2. To your visual, drag the Date field from the Calendar Table and Answer field from the Data Table
  3. Write this measure

Measure1 = COUNTROWS(Data)/CALCULATE(COUNTROWS(Data),ALL(Data[Answer]))

Format Measure1 as a %.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example.

 

if you need % of the total then

countrows(Table)/calculate(countrows(Table),all(Table))

Appreciate your Kudos.

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.