Forum Discussion
Quarter Wise Calculations in a Table format
- 1 year ago
Add a date table, joined to the reporting date column, with a quarter column
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Add classification to rows and quarter to columns for a matrix visual. Then you would need measures for the values i.e.
Active = calculate( countrows( facts), fact[status] = "Active" )
Inactive = calculate( countrows( facts), fact[status] = "Inactive" )
Sales = sum( fact[sales] )
Not sure how you want to calculate the card percentages or the green Vs grey sales
- 1 year ago
OK this is now clear
Total Sales/Total Sales = Total Sales of Q1 / Total Sales of Q2
what about Active, what is the meaning of that? So I can check the right DAX cose of that
Deku suggested
Active = calculate( countrows( facts), fact[status] = "Active" )
Inactive = calculate( countrows( facts), fact[status] = "Inactive" )
Sales = sum( fact[sales] )
Rest will be
Total Sales Q1 = CALCULATE ( [Sales], Calendar[Quarter]="Q1" )
Total Sales Q2 = CALCULATE ( [Sales], Calendar[Quarter]="Q2" )
Ratio = DIVIDE ( [Total Sales Q1], [Total Sales Q2] )
Best
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
but I want to be sure that Active is a count of rows or might be a number of distinc values of some column, can you clarify this?
Thanks
- 1 year ago
Add a extra condition in the calculate(). If the calendar table extends past the current year could use year( today() ) or some other logic if you want filtering to affect it
Like
Total Sales Q1 =
Var maxYear = calculate(max( calendar[year] ), removefilters( calender) )
Return
CALCULATE ( [Sales], Calendar[Quarter]="Q1"
Calendar[year] = maxYear)
Add a date table, joined to the reporting date column, with a quarter column
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Add classification to rows and quarter to columns for a matrix visual. Then you would need measures for the values i.e.
Active = calculate( countrows( facts), fact[status] = "Active" )
Inactive = calculate( countrows( facts), fact[status] = "Inactive" )
Sales = sum( fact[sales] )
Not sure how you want to calculate the card percentages or the green Vs grey sales
Thanks! Meanwhile I try with the logics provided by you, you can reference below sample table of Q2
| Project Type | Classification | Reporting Date | Sales | Status |
| Strategic | Chronological | Apr-25 | Inactive | |
| Strategic | Chronological | Apr-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Apr-25 | 72419.68 | Inactive |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Apr-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | 159000.00 | Inactive |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | Jun-25 | 275000.00 | Inactive |
| Strategic | Chronological | Apr-25 | 670000.00 | Inactive |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | Jun-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | Apr-25 | Inactive | |
| Strategic | Chronological | Apr-25 | 163021.00 | Inactive |
| Strategic | Chronological | May-25 | 140000.00 | Inactive |
| Strategic | Chronological | May-25 | Inactive | |
| Strategic | Chronological | Apr-25 | Inactive | |
| Strategic | Chronological | Apr-25 | Inactive | |
| Strategic | Chronological | Apr-25 | 20535576.00 | Active |
| Strategic | Chronological | Apr-25 | Inactive |