Forum Discussion

Airwen's avatar
Airwen
Frequent Visitor
2 years ago

Merge tables for a weather forecast

Hi,

I'm working on a project to create a weather forecast based on 3 variables: temperature, cloud cover, type of rainfall.
I received external help to extract the weather data and apply it to the historical data based on the city name -> "Historique" table (Ville).
There is then a "Prévisionnel" table which extracts the weather for the next 15 days from visualcrossing and arranges it by date, week and town name.
Would it be possible to merge these two tables and get the sales quantity (QuantiteTotalHebdo) per "Code Client" and "Reference Article"?
The table would run over the two weeks of the weather forecast with an average of the quantity sold in the "historique" table.
To search the quantity, I thought of selecting for each criterion with a margin of 20%. For example, the average temperature is 20°C in week number 15. We search for each year and the customer quantity sold in the same week. If the temperature is the same +/- 20%, we take it. If the conditions are met over 3 years, it would be an average of the quantity. Same goes for cloud cover and rain type.
The summary table would look like this:

DateSemainePrevisionsVilleréférence articlecode clienttemp_moyenne (°C)couverture_nuageuse (%)type_precipitationQte tempQte couvQte type
26-août-2435BRUGUIERES1005G10721,783rain507
26-août-2435CHAVANOD915T59517,675rain436

I first tried to do this with the DAX, but it didn't seem practical.
With this table, it's possible to create a chart of the predicted sales on the filtered variable.
Bellow the link to the pbix file :
link
Many thanks

5 Replies

  • What benefits are you expecting from merging the tables?  Is that something that could be done better in the data model.

    • Airwen's avatar
      Airwen
      Frequent Visitor

      Hi lbendlin 
      Merging would help to link side tables such as a customer base and an item base and then show the result from different angles. Someone helped build the data model, but we can't work together. My knowledge of Python is too short to rebuild the model. The aim was to use the existing data.
      Kind regards

      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        I would recommend to spend some time learning how to create and manage data models.