The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I would like to calculate various ratios per day.
For example, I have a column with possibility of values A, B for each day.
I would like to calculate the ratio of A to totals.
Certain days I can have no values of A.
When I use the following measure, I will have blanks instead of zeros.
Solved! Go to Solution.
Figured that would happen. Try this instead.
NewMeasure = var vResult = [YourExpression]
Return IF(AND(NOT(ISBLANK([Count])), ISBLANK(vResult)), 0, vResult)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Just tweak your measure like below:
Add 0 there
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Tried that but still have blanks on days without any EVent of type "A"
Use IF(ISBLANK(Your Measure), "0", Your measure)
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Use IF(ISBLANK(Your Measure), "0", Your measure)
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
the ISBLANK() function requires a parameter though. but if i put my measure inthere, i have the same issue with the proposed solution from mahoney below, i get dates from my date table where theres no data at all
Try this
Column =
VAR _res = DIVIDE( CALCULATE( COUNT('Model'[ID]), 'Model'[Event] = "A"), CALCULATE( COUNT('Model'[ID]) ) )
RETURN
IF ( ISBLANK(_res), 0, _res)
Regards
Phil
Proud to be a Super User!
Please share a sample Pbix, It would be easier for us all to help you.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Just add +0 to the end of your expression.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
it adds also all the dates from my model where no data is generated. which is not what I want. this happens when i have a 1to many relationswhip with my date table and use the date column from the date table.
Figured that would happen. Try this instead.
NewMeasure = var vResult = [YourExpression]
Return IF(AND(NOT(ISBLANK([Count])), ISBLANK(vResult)), 0, vResult)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.