Forum Discussion
How to show comparing date in bar chart?
- 6 years ago
I would look through appSource visuals to see if something there meets your needs. Alternatively, you can trick an array into doing this by making a date table (unrelated to the data), a measure that compares the date with the completed/expected dates, and the conditional formatting in the background and font. See the following example, using the week column of a date table (you could use date, month, and so on) to get the result. It also uses the Show in Rows function of the array visual.
The measures used above are (replace BarChart with the actual name of the table)
Esperado. • var mindate - MIN('Date'[Date])return if(mindate<-MIN(BarChart[Expected]),1)Completado. • var mindate - MIN('Date'[Date])return if(mindate<-MIN(BarChart[Completed]),1)If this works for you, mark it as the solution. Praise is also appreciated. Please let me know if you don't.
Best regards
Pat
I would look through appSource visuals to see if something there meets your needs. Alternatively, you can trick an array into doing this by making a date table (unrelated to the data), a measure that compares the date with the completed/expected dates, and the conditional formatting in the background and font. See the following example, using the week column of a date table (you could use date, month, and so on) to get the result. It also uses the Show in Rows function of the array visual.
The measures used above are (replace BarChart with the actual name of the table)
If this works for you, mark it as the solution. Praise is also appreciated. Please let me know if you don't.
Best regards
Pat
Hello Pat,
Thanks for your constructive advice! From your chart, it is almost what I need. However, I am still confusing that how to make Power BI show the 1, 2, ... 23 on the x-asix? I need to create a separate table which includes one date columns, and create 2 measures as you shown. But I have no idea about conditional formatting on background. Would you mind explaining more detail for me?
Best regards,
Weicong
- mahoneypat6 years ago
Microsoft Employee
Please see the attached pbix with the example. You will note that I made two measures - Expected. and Completed. to return a value of 1 if the Week in context (from the matrix columns) is <= the respective date (expected or completed). That value of 1 is returned to the cell and used to set conditional formatting or not (blanks are not formatted). Note that both the background color and font color have the same conditional formatting (so the 1 is not seen in the visual).
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- wfeng6 years agoRegular Visitor
Hello Pat,
Thanks for your detailed explanation! Your solution is good enough for me!
Best regards,
Weicong