The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
When I create a boolean field on the desktop, it returns true or false. On the web it shows 0 and -1
These are fields in the calendar using functions of current year, current month
Solved! Go to Solution.
but my field created in M, I modified it this way
= Table.AddColumn(ProximoDia, "mesatual", each if Date.IsInCurrentMonth([DataBase]) then 1 else 0)
The difference in the boolean field representation between Power BI Desktop and the Power BI web service is due to how the two platforms handle boolean values. In Power BI Desktop, boolean values are represented as "True" and "False," while in the Power BI web service, they are represented as numeric values of 1 and 0 (or -1 in some cases).
To ensure consistency in the representation of boolean fields across both Power BI Desktop and the web service, you can use the DAX function `IF` to explicitly convert the boolean expression to numeric values.
Here's an example of how you can use the `IF` function to convert a boolean field to numeric values in Power BI Desktop:
```dax
NumericField = IF('Table'[BooleanField], 1, 0)
```
In this example, `'Table'[BooleanField]` represents your boolean field. If the boolean field is true, the `IF` function will return 1; otherwise, it will return 0.
By using this formula to create a new calculated column or measure in Power BI Desktop, you can ensure that the boolean field is represented consistently as numeric values of 1 and 0 across both Power BI Desktop and the Power BI web service.
Please note that when you create a boolean field directly in the Power BI web service using functions like `current year` and `current month`, the representation of true and false as 0 and -1 is the default behavior. Using the `IF` function as described above can help maintain consistency with Power BI Desktop.
but my field created in M, I modified it this way
= Table.AddColumn(ProximoDia, "mesatual", each if Date.IsInCurrentMonth([DataBase]) then 1 else 0)
User | Count |
---|---|
65 | |
60 | |
55 | |
54 | |
31 |
User | Count |
---|---|
180 | |
88 | |
70 | |
46 | |
46 |