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
Peter_au
Helper I
Helper I

Access Query to Power BI Table Challenge

Hello,

 

I have a query and a table in Access. I have used a query to produce a simple resultant table.

 

I have connected the query and table with their relationships to Power BI and I am trying to produce the same result in Power BI. 

I can produce the required result in Access, but not in Power BI.

 

I have a Date table with the required relationship to the tables in Power BI. I have also tried a Disconnected Date Table, but it is not an ideal solution as there are other graphs on the same page which rely on the filters.

I have tried multiple different approaches and have trolled through previous posts, but have gotten nowhere with this one.

 

Below is the expected result

 

Batch_ColourSumOfTonnes_Blast_id
RomPad3_Finger_Gris1152
RomPad3_Finger_Jaune2592
RomPad3_Finger_Orange960

 

 

 The tables and relationships

 
 

Query1.PNG

Table 1

Date_TirageDate_TransfertBatch_nbTonnes_Blast_id
2020-07-012020-07-01RomPad3_Finger_Orange_B00059336
2020-07-012020-07-01RomPad3_Finger_Orange_B00059288
2020-07-012020-07-02RomPad3_Finger_Violet_B00057288
2020-07-032020-07-03RomPad3_Finger_Gris_B00060288
2020-07-032020-07-03RomPad3_Finger_Jaune_B00062144
2020-07-032020-07-04RomPad3_Finger_Gris_B00060336
2020-07-042020-07-04RomPad3_Finger_Gris_B00060288
2020-07-042020-07-05RomPad3_Finger_Jaune_B00062768
2020-07-052020-07-05RomPad3_Finger_Gris_B00060240
2020-07-052020-07-05RomPad3_Finger_Jaune_B00062336
2020-07-052020-07-05RomPad3_Finger_BT_B00055240
2020-07-052020-07-06RomPad3_Finger_Jaune_B00062720
2020-07-052020-07-06RomPad3_Finger_Jaune_B00062624
2020-07-062020-07-07RomPad3_Finger_Orange_B00063288
2020-07-062020-07-07RomPad3_Finger_BT_B0005548
2020-07-062020-07-07RomPad3_Finger_Orange_B0006348
2020-07-062020-07-07RomPad3_Finger_BT_B00055336
2020-07-062020-07-07RomPad3_Finger_Orange_B00063192
2020-07-062020-07-07RomPad3_Finger_Violet_B00064768
2020-07-072020-07-07RomPad3_Finger_Orange_B00063384
2020-07-072020-07-08RomPad3_Finger_Orange_B00063480
2020-07-072020-07-08RomPad3_Finger_Orange_B00063288
2020-07-082020-07-09RomPad3_Finger_Orange_B00063240
2020-07-082020-07-09RomPad3_Finger_Violet_B00064288
2020-07-082020-07-09RomPad3_Finger_Violet_B000641104
2020-07-092020-07-09RomPad3_Finger_Orange_B00063192
2020-07-092020-07-09RomPad3_Finger_Orange_B00063144
2020-07-092020-07-09RomPad3_Finger_Orange_B00063192
2020-07-092020-07-09RomPad3_Finger_Orange_B00063144
2020-07-092020-07-09RomPad3_Finger_Orange_B00063288
2020-07-092020-07-09RomPad3_Finger_Orange_B0006348
2020-07-092020-07-09RomPad3_Finger_Orange_B0006348
2020-07-09  336
2020-07-09  288
2020-07-09  144
2020-07-09  288
    

 

 

Table two

 

Batch_nbOpen_DateClose_DateBatch_Colour
RomPad3_Finger_Gris_B000522020-06-232020-06-25RomPad3_Finger_Gris
RomPad3_Finger_Orange_B000532020-06-262020-06-29RomPad3_Finger_Orange
RomPad3_Finger_Jaune_B000542020-06-262020-06-29RomPad3_Finger_Jaune
RomPad3_Finger_BT_B000552020-06-27 RomPad3_Finger_BT
RomPad3_Finger_Stérile_B000562020-06-292020-07-02RomPad3_Finger_Stérile
RomPad3_Finger_Violet_B000572020-06-302020-07-03RomPad3_Finger_Violet
RomPad3_Finger_Orange_B000592020-07-012020-07-06RomPad3_Finger_Orange
RomPad3_Finger_Gris_B000602020-07-032020-07-07RomPad3_Finger_Gris
RomPad3_Finger_Jaune_B000622020-07-032020-07-07RomPad3_Finger_Jaune
RomPad3_Finger_Orange_B000632020-07-07 RomPad3_Finger_Orange
RomPad3_Finger_Violet_B000642020-07-07 RomPad3_Finger_Violet

 

I am at a loss as how to do this. Any ideas?

8 REPLIES 8
MFelix
Super User
Super User

Hi @Peter_au ,

 

In you table the last lines don't have any batch information.

MFelix_0-1594383383810.png

However making use of your data I was abble to make the result crrect for the two top lines Jaune and Gris, as refered believe the difference is on the missing data.

 

Think it has to do with the way you setup your slicers.

 

Check PBIX file attach.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi Miguel,

 

I think it is getting close.

 

The data in the table is missing because that is the reality of the input data. There is often no data for the last day and/or there may be missing dates in the table. That is why I need to have a date table attached to allow the user to chose any date available as the other graphics on the report are dependant on those consecutive dates. 

 

I was trying to avoid an independant date table as I would have to produce a new measure for every graphic on the page.

 

Cheers

Peter

 

 

Hi @Peter_au ,

 

How do you know were the blank values go to?

 

When you add the blank lines in the model since theres is no Batch you will get a line with blank and the quantity related with the date.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



The blank values mean there are no values on that particular date.

The table will be blank for that date. Ideally it will look like this, or nothing in the tonnes column if there is no data.

Peter_au_0-1594387581515.png

 

Hi @Peter_au ,

 

So just to make it clear you want to have a single slicer for the date and then make the selection of filter according to this:

  • Open date < Filter Date
  • Date Tirage < Filter Date
  • Closed Date > Filter date

Is that you question?

 

If it is this you only option as you are refering is to have a date table because of two issues:

  • Two the dates are based on same table
  • You have different option depending on the date so this needs to be passed by a measure with variables

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



The date filters are correct. They come from two different tables

 

The sums are based on the Batch colour.

 

I have tried using the selectedvalue function to pass the date selected by the user to the measure, it didn't work.

Here are the relationships.

relationships.PNG

Can you share the syntax of your measures?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



I did the query in Access and have the below table to work with.

Date_TransfertBatch_nbSumOfTonnes_Blast_idClose_DateOpen_DateBatch_Colour
2020-07-01RomPad3_Finger_Orange_B000596242020-07-062020-07-01RomPad3_Finger_Orange
2020-07-02RomPad3_Finger_Orange_B000593362020-07-062020-07-01RomPad3_Finger_Orange
2020-07-03RomPad3_Finger_Jaune_B000621442020-07-072020-07-03RomPad3_Finger_Jaune
2020-07-04RomPad3_Finger_Gris_B000606242020-07-072020-07-03RomPad3_Finger_Gris
2020-07-05RomPad3_Finger_Gris_B000602402020-07-072020-07-03RomPad3_Finger_Gris
2020-07-05RomPad3_Finger_Jaune_B0006211042020-07-072020-07-03RomPad3_Finger_Jaune
2020-07-06RomPad3_Finger_Jaune_B0006213442020-07-072020-07-03RomPad3_Finger_Jaune

 

Here is my non working measure.

 

Tonnes = calculate(
sum(qry_Daily_Finger[SumOfTonnes_Blast_id]),
filter(all(qry_Daily_Finger),
qry_Daily_Finger[Open_Date]<[Selected_date]
&& qry_Daily_Finger[Close_Date]>[Selected_date]
&& qry_Daily_Finger[Date_Transfert]<[Selected_date]
&&qry_Daily_Finger[Date_Transfert]<=max(qry_Daily_Finger[Date_Transfert])
)
)
 
The Selected Date is a measure as follows
 
Selected_date = format(DATEVALUE([selected_Year] & "-" & [Selected_Month_Abv] & "-" & [Selected_Day_nb2]),"YYYY-MM-DD")
 selected_Year = SELECTEDVALUE((date_Tbl[Year]))
Selected_month_2 = month([Selected_date])
Selected_Day_nb2 = SELECTEDVALUE(date_Tbl[Day_nmb_2])
 

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.