cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
SpiroswayGR
Resolver III
Resolver III

Division between 2 Different source tables

Dear all,

 

First of all ,  we have 2 tables : On 1st table , we have revenue data (fake data) and on 2nd table we have (Days)_ and we want to divide revenue with days and create a new table.

Pos foods = Category Description

Codes = BB , FB , HB

And Numbers right is revenue 

Also we have filters on specific Shop with his code = 1 

SpiroswayGR_0-1625138027967.png

 

2nd table (Code per shop) with days

SpiroswayGR_1-1625138202501.png

 

So when we filter shop 1 and get data from table , somehow we want to divided on new table with the numbers of table 2 in column 1 cause column 1 is shop1. If we choose shop2 we want to divide with 2nd column from table2 etc.

 

Example : BB : 674,51 / 68

FB : 79,22 / 6 

HB : 666,18 / 26

 

Both tables are connnected with Calendar Table on Date.

 

Thank you for your help.

 

Kind Regards,

Spyros 

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

Hi @SpiroswayGR ,

You can create a measure as below, please find the details in the attachment.

Measure = 
VAR _rev =
    CALCULATE (
        SUM ( 'Table1'[Revenue] ),
        FILTER ( 'Table1', 'Table1'[POS FOODS] = SELECTEDVALUE ( 'Table2'[Code] ) )
    )
RETURN
    DIVIDE ( _rev, CALCULATE ( SUM ( 'Table2'[Days] ) ), 0 )

yingyinr_0-1625454439358.png

If the above one is not your expected result, please provide some sample data with Text format and your expected result with backend logic and specific examples. Thank you.

Best Regards

Community Support Team _ Rena
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

3 REPLIES 3
SpiroswayGR
Resolver III
Resolver III

@v-yiruan-msft 

Thank you for your time.

I will test it to see how it works.

v-yiruan-msft
Community Support
Community Support

Hi @SpiroswayGR ,

You can create a measure as below, please find the details in the attachment.

Measure = 
VAR _rev =
    CALCULATE (
        SUM ( 'Table1'[Revenue] ),
        FILTER ( 'Table1', 'Table1'[POS FOODS] = SELECTEDVALUE ( 'Table2'[Code] ) )
    )
RETURN
    DIVIDE ( _rev, CALCULATE ( SUM ( 'Table2'[Days] ) ), 0 )

yingyinr_0-1625454439358.png

If the above one is not your expected result, please provide some sample data with Text format and your expected result with backend logic and specific examples. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yiruan-msft  Thank you again very much.

 

It was working perfecty with some minor fixes cause i am using "Measures" to calculate revenue so i had to remove "SUM" in both cases and worked perfectly.

 

Also i was trying to calculate also for LY on same period , i have the revenue_LY , i have days in LY but somehow divide is not working.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors