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
JLambs20
Helper III
Helper III

Calculating Revenue and Targets in one Table

Hello!

I am looking to create a bar chart with a date across the x-axis and then awarded/target values as the two bars (per year).  I need to be able to drill down into each year at least to the Quarter. 

 

Table 1 contains site, award date, and award value while table 2 contains site, target year, and target value. Summarizing the awarded value in table 1 by year is easy enough in a measure but I'm having trouble incorporating the table 2 data.  For the target values, it would be by year, so there needs to be a sum of the target value of all sites by year (in other words, the target value for 2021 is site A + site B + site C + site D, or 2000 and the same thing for 2022, and 2023). 

The result would look something like this: 

JLambs20_0-1654535147605.png

 

Here's some sample data: 

JLambs20_1-1654535185789.png

Thank you!

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

Hi  @JLambs20 ,

Here are the steps you can follow:

1. Create a GroupTable with Enter data.

vyangliumsft_0-1654744932567.png

2. Create calculated Date_Table.

Date_Table =
CALENDAR(DATE(2021,1,1),DATE(2024,12,31))

vyangliumsft_1-1654744932568.png

3. Create measure.

Measure =
CALCULATE( SUM('Table1'[Award Value]),FILTER(ALL('Table1'),'Table1'[Award Date]>=MIN('Date_Table'[Date])&&'Table1'[Award Date]<=MAX('Date_Table'[Date])))
Measure1 =
CALCULATE( SUM('Table2'[Target Value]),FILTER(ALL(Table2),'Table2'[Year]>=YEAR(MIN('Date_Table'[Date]))&&'Table2'[Year]<=YEAR(MAX('Date_Table'[Date]))))
Flag=
SWITCH(
    TRUE(),
    MAX('GoupTable'[Group])="Actual Revenue",[Measure],
    MAX('GoupTable'[Group])="Target Revenue",[Measure1])

4. Result:

When the X axis is Year:

vyangliumsft_2-1654744932571.png

When Dill down:

vyangliumsft_3-1654744932575.png

 

Best Regards,

Liu Yang

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

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @JLambs20 ,

Here are the steps you can follow:

1. Create a GroupTable with Enter data.

vyangliumsft_0-1654744932567.png

2. Create calculated Date_Table.

Date_Table =
CALENDAR(DATE(2021,1,1),DATE(2024,12,31))

vyangliumsft_1-1654744932568.png

3. Create measure.

Measure =
CALCULATE( SUM('Table1'[Award Value]),FILTER(ALL('Table1'),'Table1'[Award Date]>=MIN('Date_Table'[Date])&&'Table1'[Award Date]<=MAX('Date_Table'[Date])))
Measure1 =
CALCULATE( SUM('Table2'[Target Value]),FILTER(ALL(Table2),'Table2'[Year]>=YEAR(MIN('Date_Table'[Date]))&&'Table2'[Year]<=YEAR(MAX('Date_Table'[Date]))))
Flag=
SWITCH(
    TRUE(),
    MAX('GoupTable'[Group])="Actual Revenue",[Measure],
    MAX('GoupTable'[Group])="Target Revenue",[Measure1])

4. Result:

When the X axis is Year:

vyangliumsft_2-1654744932571.png

When Dill down:

vyangliumsft_3-1654744932575.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


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

This works when set up the way you mentioned, however, it doesn't allow me to drill down on the award date since we're using the distinct year as the x-axis. Once we've figured that out, I'll be good to go!

dengodunov
Frequent Visitor

Hello, @JLambs20 !

I did it this way:

1. Create table with distinct years (DimYear)

2 Create table YearlyAwarded

YearlyAwarded = SUMMARIZE('Table1',[YEAR],"YearlyAward",SUM('Table1'[Award Value]))
3 Create table YearlyTarget:
YearlyTarget = SUMMARIZE('Table2',[Year],"YearlyTarget",SUM('Table2'[Target Value]))
4 Connected all tables
001.jpg
002.jpg

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.