Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
dethnass
Helper I
Helper I

divide two value by different tables (date problem)

Hello I would like to know how to divide the values of two columns from two different tables using group by. Major Problem is the tables doesnt have same Date set. In the first table, the rows contains time series data but second table doesnt.

 

For Example:

 

Table1 is like:

 

Date Data
1.10.2019 15
3.10.2019 34
4.10.2019 35
5.10.2019 36
7.10.2019 48
8.10.2019 52
9.10.2019 21
10.10.2019 35
11.10.2019 101
12.10.2019 77
13.10.2019 104
15.10.2019 80
16.10.2019 132
18.10.2019 176

 

And Table2 is:

 

Date Data
1.10.2019 33
2.10.2019 54
10.10.2019 150
11.10.2019 201
12.10.2019 174
13.10.2019 80
16.10.2019 137
17.10.2019 169
18.10.2019 181

 

I'm a bit of a novice and so if anyone can help with the DAX that would be appreciated!

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @dethnass 

try measure in Table1

Measure = 
var _tbl1Val = SUM(Table1[Data])
var _tbl1Date = MAX(Table1[Date])
var _tbl2Sum = CALCULATE(SUM(Table2[Data]), Table2[Date] = _tbl1Date)

RETURN
DIVIDE(_tbl1Val, _tbl2Sum)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

4 REPLIES 4
az38
Community Champion
Community Champion

Hi @dethnass 

try measure in Table1

Measure = 
var _tbl1Val = SUM(Table1[Data])
var _tbl1Date = MAX(Table1[Date])
var _tbl2Sum = CALCULATE(SUM(Table2[Data]), Table2[Date] = _tbl1Date)

RETURN
DIVIDE(_tbl1Val, _tbl2Sum)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

I am struggleing for 3 days to figure out how to solve similar case I have.
Million of Thanks👍

ryan_mayu
Super User
Super User

@dethnass 

 

What's the output that you want?

 

Have you tried VAR function like below?

measure = 
VAR value1= value from table1
VAR value2= value from table2
return divided(value1,value2)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu 

 

I have an also 2x measure like


table1data = SUM(Table1[Data])

table2data = SUM(Table2[Data])

And my final output code like this.


measure =
VAR value1= [table1data]
VAR value2= [table2data]
return DIVIDE(value1,value2)


When i put that measure on line chart with the date its not work properly.

As my above post i will send my sample data again:

 

Table1 :

 

Date Data
1.10.2019 15
3.10.2019 34
4.10.2019 35
5.10.2019 36
7.10.2019 48
8.10.2019 52
9.10.2019 21
10.10.2019 35
11.10.2019 101
12.10.2019 77
13.10.2019 104
15.10.2019 80
16.10.2019 132
18.10.2019 176

 

Table2 is:

 

Date Data
1.10.2019 33
2.10.2019 54
10.10.2019 150
11.10.2019 201
12.10.2019 174
13.10.2019 80
16.10.2019 137
17.10.2019 169
18.10.2019 181


Now I want to create a measure to divide each data column by its corresponding date. Please let me know. Thanks!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.