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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ashraf_SISL1
Helper II
Helper II

Three tables with one common date column

Hi Team,

 

I have attached format database of power sector, Where master table have the records of user activation date/Billinfo has the records on monthly basis bill generation/ same way payment has the records on monthly basis payment details.

 

Once consumer gets activated, we generate bill for user on every month & user also may or may not pay every month(As user can 02 month bill on at once as well)

 

Now as per the attach tables, i want to get the details for every month, for example nov month i need below,

 

Total users - 9

Biiled user - 8

Paid user -  7 

 

how to acheive this.

 

Thanks,

Ashraf 

 
2 ACCEPTED SOLUTIONS

You can create date dimension and join all three dates with that. One active other inactive. Using userelation, you can create measures that can tell based on each date active, billed and paied.

check how to use multiple date at :https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

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 Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

View solution in original post

Hi,

 

You can try to use SelectColumns function to create three tables which have the same number of columns.

And then you can union them and follow the steps in my previous reply.

 

Best Regards,

Giotto Zhi

 

View solution in original post

7 REPLIES 7
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try these measures:

Total Users = COUNTROWS(DISTINCT(Master[UserNo]))
COUNTROWS(BillInfo)
User Paid = COUNTROWS(Payment)

And it shows:

21.PNG

Best Regards,

Giotto Zhi

@v-gizhi-msft  ..if i filter this by month, It gives me total user For Sep -1, Oct - 7 & Nov -1

but in actual it should be Sep -1, Oct - 8 & Nov -9 (need total no of user till date for master table & for bill & paid only distinct count of that month)

Hi,

 

Please try to create a calculated table:

Table = UNION(BillInfo,Payment,Master)

Then change the original total measure to this:

Total Users = CALCULATE(DISTINCTCOUNT('Table'[UserNo]),ALLEXCEPT('Table','Table'[Bill Date].[Month]))

And the result shows:

32.PNG

 

Best Regards,

Giotto Zhi

@v-gizhi-msft  For union all tables must have same no of columns which i don't have in my database

Hi,

 

You can try to use SelectColumns function to create three tables which have the same number of columns.

And then you can union them and follow the steps in my previous reply.

 

Best Regards,

Giotto Zhi

 

ashraf_SISL1
Helper II
Helper II

Master BillInfo Payment
UserNoActive date UserNoBill Date UserNoPayment Date
11001-Sep-19 110015-Oct-19 110025-Oct-19
11011-Oct-19 110116-Oct-19 110126-Oct-19
11022-Oct-19 110215-Oct-19 110225-Oct-19
11033-Oct-19 110318-Oct-19 110326-Oct-19
11044-Oct-19 110415-Oct-19 110425-Oct-19
11055-Oct-19 110514-Oct-19 110527-Oct-19
11066-Oct-19 110618-Oct-19 110025-Nov-19
11077-Oct-19 110015-Nov-19 110126-Nov-19
11087-Nov-19 110116-Nov-19 110225-Nov-19
Result 110217-Nov-19 110327-Nov-19
Total Users 9 110318-Nov-19 110428-Nov-19
   110419-Nov-19 110525-Nov-19
MonthUsers Billed  110520-Nov-19 110625-Nov-19
Oct7 110617-Nov-19 110025-Dec-19
Nov8 110718-Nov-19 110126-Dec-19
Dec9 110015-Dec-19 110225-Dec-19
   110116-Dec-19 110326-Dec-19
MonthUsers Billed  110215-Dec-19 110425-Dec-19
Oct6 110318-Dec-19 110527-Dec-19
Nov7 110415-Dec-19 110625-Dec-19
Dec9 110514-Dec-19 110726-Dec-19
   110615-Dec-19 110825-Dec-19
   110718-Dec-19   
   110814-Dec-19   

You can create date dimension and join all three dates with that. One active other inactive. Using userelation, you can create measures that can tell based on each date active, billed and paied.

check how to use multiple date at :https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

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 Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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