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.
Hi all,
I have two tables: Calendar and CountriesHolidays:
I have to combine them to in order to create a new column in the Calendar table where I must assign a '0' when it's a Holiday in Portugal and Brazil. I've tried different solutions, but nothing seems to result. Joining tables through PowerQuery isn't possible cause I do not have access to the source files.
Any ideas? Thanks very much
Solved! Go to Solution.
Hi @FredericoMM ,
The issue was that in my test file I did not had repeated values in the dates for holidays now it works properly:
Use the formula below:
Is Holiday =
IF (
COUNTROWS (
FILTER (
CountriesHolidays;
CountriesHolidays[ds_holidays] = 'Calendar'[Date]
&& CountriesHolidays[Is_country] = 1
)
) >= 1;
1;
0
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi Frederico,
Add the following colums to your data:
Table Holidays new column:
Is_country = IF('Table'[Country] in {"Portugal"; "Brazil"};1 ; 0)
Table Calendar new column:
Is Holiday =
LOOKUPVALUE('Table'[Holiday];'Table'[Date];'calendar'[Date];'Table'[Is_country];1)
Or a value with 1
Is Holiday =
LOOKUPVALUE('Table'[Is_country];'Table'[Date];'calendar'[Date];'Table'[Is_country];1)
then you can filter out on your measure the columns is holiday = 1
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi, @MFelix
Thank you for your fast solution.
Unfortunately, the second part of it isn't working properly... It shows 1 and 0 randomly, apparently.
Basically I need that column 'Alocação', to show '0' instead of '8' when whether it is a holiday in PT and BR:
Thanks in advance!
Hi @FredericoMM ,
The last parameter on your formula is missing so it's not searching for the countries that are marked in the holiddays table you have:
Is Holiday =
LOOKUPVALUE(CountriesHolidays[Is_country];CountriesHolidays[ds_holidays];'calendar'[Date].Date;1)
The formula must be:
Is Holiday =
LOOKUPVALUE(CountriesHolidays[Is_country],CountriesHolidays[ds_holidays],'calendar'[Date].Date,CountriesHolidays[Is_country],1)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks, @MFelix
When I paste the formula to create a new column and then I filter for '1' , it just seems to have 3 rows:
This is not correct...
Hi @FredericoMM ,
Is your formula on the holidays table giving you the correct values for the dates that are in Portugal and Brazil?
The column you are creating is on the Calendar table correct? (sorry for asking)
Make a small adjustment and try this one.
Is Holiday =
LOOKUPVALUE(CountriesHolidays[Is_country],CountriesHolidays[ds_holidays],'calendar'[Date],CountriesHolidays[Is_country],1)
If this doesn't work are you abble to share a sample file so I can check if there is something else with the structure of your data?
If the information is sensitive you can share it in private message (the files can be share by onedrive, googledrive, we transfer or similar links).
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsYes, Is_Holiday is in my Calendar table.
It stills get me only 3 row with '1':
How should I send you, @MFelix ?
Hi @FredericoMM ,
The issue was that in my test file I did not had repeated values in the dates for holidays now it works properly:
Use the formula below:
Is Holiday =
IF (
COUNTROWS (
FILTER (
CountriesHolidays;
CountriesHolidays[ds_holidays] = 'Calendar'[Date]
&& CountriesHolidays[Is_country] = 1
)
) >= 1;
1;
0
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @FredericoMM ,
Can you send it trough private message on a onedrive, google drive, wetransfer or similar link, please.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português@FredericoMM , pivot on country and try have holiday columns country wise and then join on date. otherwise left join on the date table should work
https://radacad.com/pivot-and-unpivot-with-power-bi
Hi,
I can't pivot cause I don't have access to the sources, therefore I am not able to use PowerQuery for that.
I tried to left join as you suggested, but I couldn't do it. How should I left join this case?
Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |