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
corbincdc
Frequent Visitor

Formatting data for text aggregation

Hello-

I am a little new to Power Bi. We operate a property management company. We have a data set that shows payments by source for a property.  I am trying to produce the following report in Power Bi - Fig 1. The raw data set comes in shown in Fig 2.

I am thinking I need to pivot the data with the distict paytment types in to seperate columns.  We want the flexablity to filter for date ranges in the visualzation.

 

Fig. 1 

Property Look up Code Payments online 
186-000096% 
196-000055%
187-000068%

 

 

 

 

Fig 2. 

Annotation 2020-02-17 202714.png

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Drag the Property Look-up code to the visual and write these measures

Total payments = COUNTROWS(Data)

Online payments = CALCULATE([Total payments],Data[Type]="Online payment")

Online payments (%) = [Online payments]/[Total payments]

Drag the last measure to the visual.

Hope this helps.


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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Create a measure like this and have slicer of post date

 

% online = divide(calculate(count(table[lookup code]),table[type]="Online payment"),calculate(count(table[lookup code])))

 

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Ashish_Mathur
Super User
Super User

Hi,

Drag the Property Look-up code to the visual and write these measures

Total payments = COUNTROWS(Data)

Online payments = CALCULATE([Total payments],Data[Type]="Online payment")

Online payments (%) = [Online payments]/[Total payments]

Drag the last measure to the visual.

Hope this helps.


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

@corbincdc 

 

Try this measure.

 

Measure 2 = 
VAR B = CALCULATE(COUNTROWS('Prop Fact'),ALL('Prop Fact'[Type]))
VAR A = CALCULATE(COUNTROWS('Prop Fact'),FILTER('Prop Fact','Prop Fact'[Type]="Online Payment"))
RETURN DIVIDE(A,B)

 

 

image.png

Left - Date slicer

Middle - expected output

Right - Input Property fact.

 

I have a seperate date dimension and Property dimensions as below and relationships are defined as 1(date and property) to M(fact)

 

Calendar = CALENDAR(MIN('Prop Fact'[Post Dt]),MAX('Prop Fact'[Post Dt]))

 

 

 

Property = DISTINCT('Prop Fact'[Prop Code])

 

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

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.