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

Issue with a table that compares targets with real sales

Hi!

 

I have a table that have all the information about the targets of each Salesperson. The information display is Nº of Salesperson, month of the target and quantity of target.

 

 

table.PNG

 

Then on another table where I have all the sales each Salesperson do, i made a measure that has the sum of the sales each one made on each month.

 

I want to make a table on power BI that compares this measure with the target.

simmilar to this one.

 

Tocosta_0-1620307236442.png

this should have a filter where I can introduce the month so I can see only the month I selected.

 

Can anyone please help me?

 

thanks!!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Tocosta , If you have date, otherwise create date with month and year

 

date = "01-" & [month] &"-" &[year] 

 

Also create common date for sales person - Bridge Table: https://www.youtube.com/watch?v=Bkf35Roman8&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=19

 

Join these two table with Common date and common sales person tables and analyze with those 

 

% = divide(sum(Target[Target]), sum(Sales[Sales]))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

View solution in original post

v-yalanwu-msft
Community Support
Community Support

Hi @Tocosta , 

 

You could create a measure by the following formula:

_Sales =
IF (
    ISFILTERED ( Table1[Month] ),
    SUMX ( FILTER ( 'Table2', [Month] = SELECTEDVALUE ( Table1[Month] ) ), [Sales] ),
    SUM ( Table2[Sales] ))

And

compare% =
IF (
    ISFILTERED ( Table1[Month] ),
    DIVIDE (
        SUM ( 'Table1'[Target] ),
        SUMX ( FILTER ( 'Table2', [Month] = SELECTEDVALUE ( Table1[Month] ) ), [Sales] )),
    DIVIDE ( SUM ( 'Table1'[Target] ), SUM ( Table2[Sales] ) ))

Then add a filter to select month:

v-yalanwu-msft_0-1620699363070.jpeg

The final output is shown below:

v-yalanwu-msft_1-1620699363071.pngv-yalanwu-msft_2-1620699363074.jpeg

Best Regards,
Community Support Team_ Yalan Wu
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

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi @Tocosta , 

 

You could create a measure by the following formula:

_Sales =
IF (
    ISFILTERED ( Table1[Month] ),
    SUMX ( FILTER ( 'Table2', [Month] = SELECTEDVALUE ( Table1[Month] ) ), [Sales] ),
    SUM ( Table2[Sales] ))

And

compare% =
IF (
    ISFILTERED ( Table1[Month] ),
    DIVIDE (
        SUM ( 'Table1'[Target] ),
        SUMX ( FILTER ( 'Table2', [Month] = SELECTEDVALUE ( Table1[Month] ) ), [Sales] )),
    DIVIDE ( SUM ( 'Table1'[Target] ), SUM ( Table2[Sales] ) ))

Then add a filter to select month:

v-yalanwu-msft_0-1620699363070.jpeg

The final output is shown below:

v-yalanwu-msft_1-1620699363071.pngv-yalanwu-msft_2-1620699363074.jpeg

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

amitchandak
Super User
Super User

@Tocosta , If you have date, otherwise create date with month and year

 

date = "01-" & [month] &"-" &[year] 

 

Also create common date for sales person - Bridge Table: https://www.youtube.com/watch?v=Bkf35Roman8&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=19

 

Join these two table with Common date and common sales person tables and analyze with those 

 

% = divide(sum(Target[Target]), sum(Sales[Sales]))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series 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.