Forum Discussion
Calculating a measure with a virtual table
Dear all,
I need to know the total produced for each "aplicação" filtered by a date (unique value) from another table using a virtual table.
I've made the two measures below. The firts one brings me the correct result for the total and can be filtered in the visual but it's not related to the "Aplicação". The second one have a relationship but it brings the total values without filters.
Need help to understand why the measures above aren't working. I know the calculate/calculatetable "erases" the relationships. Can I make this calculation or do I need to use a physical table to find this value.
I don't know if I was clear, but appreciate some help.
Thanks,
Ricardo
3 Replies
- lbendlin
Super User
Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. Screenshots of your source data are not useful.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523- RicardoSchmidtRegular Visitor
Hi, sorry for that, I'll try to explain and put the samples better.
I have a fact table with my daily production like below:
Tubo Aplicação Prod. [ton] TDCA_CD_TP_MOVI CADA_CD_TP_MOVI DESCR_TP_MOVI CENT_COD TURN_DATA_LOGICA Prod.Peça 22 T 63803 46001 33 001 0,305 101 760 SAÍDA FÁBRICA REPROCESSO CNT.01 14/08/2022 00:00 1 22 T 59611 46020 22 001 0,193 101 760 SAÍDA FÁBRICA REPROCESSO CNT.01 06/08/2022 00:00 1 22 T 84902 46030 45 001 0,466 101 720 SAÍDA BENEFICIAMENTO CNT.02 15/08/2022 00:00 1 22 T 84759 49889 08 001 0,133 101 720 SAÍDA BENEFICIAMENTO CNT.02 11/08/2022 00:00 1 22 T 84743 49889 07 001 0,305 101 720 SAÍDA BENEFICIAMENTO CNT.01 08/08/2022 00:00 1 22 T 84719 49889 07 001 0,122 101 720 SAÍDA BENEFICIAMENTO CNT.01 08/08/2022 00:00 1 22 T 47739 49912 03 001 0,207 101 720 SAÍDA BENEFICIAMENTO CNT.02 05/08/2022 00:00 1 Then I have another fact table with my planned production:
centro dt_base dia Prog. [pç] Aplicação OD x WT CNT.02 15/08/2022 15/09/2022 3 49888 04001 36" x 1,5" CNT.02 15/08/2022 15/09/2022 2 49887 09001 36" x 1,5" CNT.02 15/08/2022 15/09/2022 2 49887 08001 36" x 1,5" CNT.02 15/08/2022 15/09/2022 11 49887 06001 22" x 1,125" CNT.02 15/08/2022 14/09/2022 21 49887 06001 22" x 1,125" CNT.02 15/08/2022 13/09/2022 22 49887 06001 22" x 1,125" CNT.02 15/08/2022 12/09/2022 21 49887 06001 22" x 1,125" CNT.02 15/08/2022 11/09/2022 5 49887 06001 22" x 1,125" CNT.02 15/08/2022 11/09/2022 13 46001 34001 36" x 1,5" CNT.02 15/08/2022 10/09/2022 2 46001 34001 36" x 1,5" CNT.02 15/08/2022 10/09/2022 8 46001 33001 36" x 1,5" CNT.02 15/08/2022 10/09/2022 1 46001 33001 36" x 1,5" CNT.02 15/08/2022 10/09/2022 6 46001 33001 36" x 1,5" CNT.02 15/08/2022 09/09/2022 30 49806 12001 20" x 0,75" CNT.02 15/08/2022 08/09/2022 31 49806 12001 20" x 0,75" CNT.02 15/08/2022 07/09/2022 19 49806 12001 20" x 0,75" And I have the dimensions table for "Aplicação" and some others like Calendar and other keys.
I need a measure that brings me the total produced until the fact table base date (column "dt_base") (<= than base date) (this date don't change until I upload a new program). This measure needs to show the values by "Aplicação" and needs to be sliced by other dimension table with keys. Something like it:
- lbendlin
Super User
sorry, I don't understand the ask. Your measure uses a "Table 2" that doesn't seem to be listed in the sample data. Can you please check and explain your expected outcome again?