Forum Discussion
IF statment doesn't work!
- 9 years ago
Beyondforce There are two parts to the Power BI Desktop. The screenshot you posted shows that you are in "Edit Queries" - this utilizes the "M" language - and that solution was provided by Vvelarde because he was smart enough to ask where you were trying this :) Once you "Close & Apply" then you are loading the data into the Tabular model front end. From here on out you need to use the "DAX" language when building measures or calculated columns. My solution works as a calculated column in DAX.
As you move back and forth between each area, just keep in mind the language changes.
Hope this helps out as you move forward!
Anonymous, Maybe you can help me with something else!
The table that I'm working on, comes from a CSV dump file (from a Main Frame). The log file doesn't count weekends, because nothing happends on weekends. But I want to add them anyway Automaticaly!
Which means, I'm going to have empty rows on the weekends rows, which is ok. Is it possible to do or would I have to create a new table for that (I hope not!)?
Thanks.
- Anonymous9 years agoNot applicable
Beyondforce If you want to display all days, you should build a date table. Then depending on what measure or calculation you use I believe you throw a "+0" at the end of your calculation to return 0 instead of "Blank"
Here is a dynamic date table that you can build in the model part in DAX. The 'FactTable' is where your dates are currently through today.
Date = ADDCOLUMNS ( CALENDAR (MINX('FactTable', [Created Date]), NOW()), "DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ), "Year", YEAR ( [Date] ), "Monthnumber", FORMAT ( [Date], "MM" ), "YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ), "YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ), "MonthNameShort", FORMAT ( [Date], "mmm" ), "MonthNameLong", FORMAT ( [Date], "mmmm" ), "DayOfWeekNumber", WEEKDAY ( [Date] ), "DayOfWeek", FORMAT ( [Date], "dddd" ), "DayOfWeekShort", FORMAT ( [Date], "ddd" ), "Quarter", "Q" & FORMAT ( [Date], "Q" ), "YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ) ) - Beyondforce9 years agoHelper I
Hi Anonymous,
Thank you very much. It it very helpfull!
I was wondering if you don't mind checking out my other post. Maybe you could think of a better idea on how to do this. I was thinking maybe, if I create new tables from each column and then build relationships, that would be a good approach, I'm not sure!?
I really appreciate your help!
Ben.
- Anonymous9 years agoNot applicable
Beyondforce Just looking at it quickly, it seems that you should just be able to relate the transaction date to the new date table I outline above. I assume the table you are creating is a visual... It should be really straightforward from there.
The date table will have year and month name
you can create a measure like this: countdate = COUNTA('Date'[Date]) for the days of month
Then it sounds like some straightforward counts on dates or other fields to round out the solution.
If this is over-simplifying, let me know - but the date table will do most of the legwork for the year/month/count of days for sure.
- Beyondforce9 years agoHelper I
Anonymous, I have found a better way... I have asked the guy who created those files, to add the extra columns that I need ;-)
Thanks for the help.